Created
September 5, 2018 10:07
-
-
Save eteeselink/607e585eb40be76f2ed150d4090e5261 to your computer and use it in GitHub Desktop.
TalkJS example for `session.on("message", ..)`
This file contains hidden or 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
// ... 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