Skip to content

Instantly share code, notes, and snippets.

@eteeselink
Created September 5, 2018 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eteeselink/607e585eb40be76f2ed150d4090e5261 to your computer and use it in GitHub Desktop.
Save eteeselink/607e585eb40be76f2ed150d4090e5261 to your computer and use it in GitHub Desktop.
TalkJS example for `session.on("message", ..)`
// ... initialize talkSession as per https://talkjs.com/docs
talkSession.on("message", function(message) {
// only process messages that the current writes, not the ones
// the current user receives
if(!message.isByMe) {
return;
}
// perform actions based on message body
if(message.body === "what is your email?") {
// send AJAX to backend to trigger an action
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment