Two way communication in the browser isn’t easy. James Coglan brings aims to change that with Faye:

Faye is an implementation of the Bayeux prototcol, a publish-subscribe messaging protocol designed primarily to allow client-side JavaScript programs to send messages to each other with low latency over HTTP.

Essentially, Bayeux lets applications publish and subscribe to data in named channels, both in the browser and the server:

fayeClient.subscribe('/path/to/channel', function(message) {
  // process received message object
});

fayeClient.publish('/some/other/channel', {foo: 'bar'});

Faye supports long polling and callback polling, depending on if you would like to keep a persistent HTTP connection open in the browser or use a JSONP callback.

The really cool part is that Faye ships with functionally identical server implementations for both Rack and Node.js.

We just might have to try this out to enhance Tail.

Source on GitHub James Coglan on Twitter


Have comments? Send a tweet to @TheChangelog on Twitter.

Subscribe to The Changelog Weekly – our weekly email covering everything that hits our open source radar.