Skip to content

Instantly share code, notes, and snippets.

@prathamesh-sonpatki
Last active May 17, 2016 08:44
Show Gist options
  • Select an option

  • Save prathamesh-sonpatki/b71262858e609ecc3e64504a42ee7132 to your computer and use it in GitHub Desktop.

Select an option

Save prathamesh-sonpatki/b71262858e609ecc3e64504a42ee7132 to your computer and use it in GitHub Desktop.
App.chat = App.cable.subscriptions.create("ChatChannel", {
connected: function() {
// Called when the subscription is ready for use on the server
},
disconnected: function() {
// Called when the subscription has been terminated by the server
},
received: function(data) {
// Called when there's incoming data on the websocket for this channel
},
speak: function() {
return this.perform('speak');
},
mute: function() {
return this.perform('mute');
},
broadcast: function() {
return this.perform('broadcast');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment