Skip to content

Instantly share code, notes, and snippets.

@ozozozd
Created November 14, 2017 04:52
Show Gist options
  • Select an option

  • Save ozozozd/a66bbd86a9ee459eaefd4505ea1c6d06 to your computer and use it in GitHub Desktop.

Select an option

Save ozozozd/a66bbd86a9ee459eaefd4505ea1c6d06 to your computer and use it in GitHub Desktop.
Provide message history for your channels
// 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