Faye

Simple pub/sub messaging for the web

What is it?

Faye is an easy-to-use publish-subscribe messaging system based on the Bayeux protocol. It provides message servers for Node.js and Rack, and clients for use in Node and Ruby programs and in the browser.

1. Start a server

var Faye   = require('faye'),
    server = new Faye.NodeAdapter({mount: '/'});

server.listen(8000);

2. Create a client

var client = new Faye.Client('http://localhost:8000/');

client.subscribe('/messages', function(message) {
  alert('Got a message: ' + message.text);
});

3. Send messages

client.publish('/messages', {
  text: 'Hello world'
});