Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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.
...
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
You can’t perform that action at this time.