Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Appending a new chat message to the time series topic. Using a JSON event to represent messages allows us to add extra metadata about the sender.
var sendTextMessage = function(session){
var input = $("#chatinput").val();
$("#chatinput").val('');
if(session.isConnected() && (input.replace(/\s/g, '').length > 0)){
var message = {
origin: chatUserId,
type: 'txtmsg',
payload: input
};
session.timeseries.append(chatTopic, message);
}
}
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.