Skip to content

Instantly share code, notes, and snippets.

@Ravenna
Created September 12, 2018 04:33
Show Gist options
  • Select an option

  • Save Ravenna/9890ec07dcfbbfe162da91e719761ab7 to your computer and use it in GitHub Desktop.

Select an option

Save Ravenna/9890ec07dcfbbfe162da91e719761ab7 to your computer and use it in GitHub Desktop.
Chat js on page
chatManager
.connect()
.then(currentUser => {
currentUser.rooms.forEach(r => currentUser.subscribeToRoom({
roomId: currentUser.rooms[0].id,
hooks: {
onNewMessage: message => {
console.log(`Received new message: ${message.text}`)
}
}
})
)
}).catch(error => {
console.error("error:", error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment