Bayeuxjs
Bayeuxjs is a copy of the Faye tools with backpressure functionality. It allows you to control the flow of messages by
giving the user control over the sending of /meta/connect
messages through the use of a callback.
In the following example, the afterLastMessage
callback will only be called after the last message in a
/meta/connect
message is processed. Messages received in a /meta/connect
message, are processed in the onMessage
callback. After receiving the first message with first: true
, the sending of a /meta/connect
message is delayed by 5
seconds. You'll notice that the output of the second message is always at least 5 seconds apart from the first one.
const bayeuxjs = ;const http = ; // Server setupconst adapter = mount: '/';const server = http; adapter;server; // Subscriber setupconst subscriber = 'http://localhost:8000/';subscriber; let receivedFirstMessage = false; subscriber; // Publishing messagesconst publisher = 'http://localhost:8000/';publisher; publisher; ;
- Documentation: http://faye.jcoglan.com
- Mailing list: http://groups.google.com/group/faye-users
- Bug tracker: http://github.com/dhulke/bayeuxjs/issues
- Source code: http://github.com/dhulke/bayeuxjs
- Faye code: http://github.com/faye/faye