Skip to content

Instantly share code, notes, and snippets.

@yankov
Created August 3, 2011 21:43
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 yankov/1123860 to your computer and use it in GitHub Desktop.
Save yankov/1123860 to your computer and use it in GitHub Desktop.
//have to include http://127.0.0.1:3333/faye.js in the html file
var client = new Faye.Client('http://127.0.0.1:3333/faye', { timeout: 120 });
var subscription = client.subscribe('/notifications/channel', function(message) {
alert(message.text);
});
//or with user_id as a channel
Badgeville.bind('afterSetUser', function() {
var client = new Faye.Client('http://127.0.0.1:3333/faye', { timeout: 120 });
var subscription = client.subscribe('/notifications/' + Badgeville.Settings.user.id, function(message) {
alert(message.text);
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment