Created
September 12, 2018 04:33
-
-
Save Ravenna/9890ec07dcfbbfe162da91e719761ab7 to your computer and use it in GitHub Desktop.
Chat js on page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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