Created
November 14, 2017 04:52
-
-
Save ozozozd/a66bbd86a9ee459eaefd4505ea1c6d06 to your computer and use it in GitHub Desktop.
Provide message history for your channels
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
| // wait for our chat to connect | |
| myChat.on('$.connected', () => { | |
| // search for 50 old `message` events | |
| myChat.search({ | |
| reverse: true, | |
| event: 'message', | |
| limit: 50 | |
| }).on('message', (data) => { | |
| // when messages are returned, render them like normal messages | |
| renderMessage(data); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment