ISNIT0 / bacon-express

Link Bacon streams over the network

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bacon Express

Link Bacon streams over the network

Installation

Node

npm i bacon-express

Browser

<script src='https://cdn.rawgit.com/ISNIT0/bacon-express/master/dist/client.js' type='text/javascript'></script>

Usage

Node

var app = express();
baconExpress(app);

var Events = Bacon.Bus();

app.bacon('/events', Events); // (HTTPpath, stream, handler?)

Browser

var Events = Bacon.fromWebsocket('/events'); //Relative or absolute Websocket path (ws://localhost:1337/events)

Events.onValue(function(a) {
  console.log(a);
});

In the above example, the Events stream (Bus in this case) from both the server and client are in sync.

About

Link Bacon streams over the network

License:The Unlicense


Languages

Language:JavaScript 94.5%Language:HTML 5.5%