Last active
October 25, 2017 12:39
-
-
Save push-gists/7ff4ddb0023337e6e6e143eb8d807fc9 to your computer and use it in GitHub Desktop.
This code shows how we receive and display new chat messages. The client registers a callback which appends all incoming messages to an HTML element with the id 'chatmessages.' Each new value streamed will also have an associated author, sequence number and timestamp.
This file contains 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
... | |
session.stream(chatTopic).asType(diffusion.datatypes.json()) | |
.on('value', function (topic, specification, newValue, oldValue) { | |
appendMessageToChat(newValue.value.get(), '#chatmessages'); | |
}); | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment