Skip to content

Instantly share code, notes, and snippets.

@suprememoocow
Created May 21, 2013 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suprememoocow/5621243 to your computer and use it in GitHub Desktop.
Save suprememoocow/5621243 to your computer and use it in GitHub Desktop.
// Start a server
var Faye = require('faye'),
server = new Faye.NodeAdapter({mount: '/'});
server.listen(8000);
// Create a client and subscribe to a channel
var client = new Faye.Client('http://localhost:8000/');
client.subscribe('/messages', function(message) { alert('Got a message: ' + message.text);
});
// Publish a message to a channel
client.publish('/messages', {
text: 'Hello world'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment