Skip to content

Instantly share code, notes, and snippets.

@hugomd
Last active May 23, 2018 11:31
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 hugomd/878ee0de00ca6ca2a67cfa1a3a318192 to your computer and use it in GitHub Desktop.
Save hugomd/878ee0de00ca6ca2a67cfa1a3a318192 to your computer and use it in GitHub Desktop.
...
const room = availableRooms[chosenRoom]
+ await currentUser.subscribeToRoom({
+ roomId: room.id,
+ hooks: {
+ onNewMessage: message => {
+ const { senderId, text } = message
+ if (senderId === username) return
+ console.log(`${senderId}: ${text}`)
+ }
+ },
+ messageLimit: 0
+ })
+ console.log(`Joined ${room.name} successfully`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment