Skip to content

Instantly share code, notes, and snippets.

@dongido001
Created July 8, 2019 16:32
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 dongido001/cdb62604592b0842879e7654d827d5e7 to your computer and use it in GitHub Desktop.
Save dongido001/cdb62604592b0842879e7654d827d5e7 to your computer and use it in GitHub Desktop.
// [...]
// fetch the channel state, subscribe to future updates
channel.watch().then(state => {
this.messages = state.messages
// Listen for new messages on the channel
channel.on('message.new', event => {
this.messages.push(event.message)
});
})
// [...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment