Skip to content

Instantly share code, notes, and snippets.

@guiltry
Created February 17, 2015 07:34
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 guiltry/5066d45e95ae917ed7d9 to your computer and use it in GitHub Desktop.
Save guiltry/5066d45e95ae917ed7d9 to your computer and use it in GitHub Desktop.
// From client side, they just need to subscribe to what they need.
window.realtime.socketIo.emit('subscribe_public', {
channel: ch
});
// or the private one,
window.realtime.socketIo.emit('subscribe_private', {
channel: ch,
jwt: localStorage.jwt
});
// and listen.
window.realtime.socketIo.on('chat', function (m) {
console.log(m.html);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment