Skip to content

Instantly share code, notes, and snippets.

@prathamesh-sonpatki
Created May 17, 2016 04:27
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 prathamesh-sonpatki/97e1718f806b92441e66cd8bb2897e14 to your computer and use it in GitHub Desktop.
Save prathamesh-sonpatki/97e1718f806b92441e66cd8bb2897e14 to your computer and use it in GitHub Desktop.
App.chat = App.cable.subscriptions.create "ChatChannel",
connected: ->
# Called when the subscription is ready for use on the server
disconnected: ->
# Called when the subscription has been terminated by the server
received: (data) ->
# Called when there's incoming data on the websocket for this channel
speak: ->
@perform 'speak'
(function() {
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');
}
});
}).call(this)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment