Created
May 22, 2021 18:23
-
-
Save smpnjn/76ca62f3ad92bf3d602c6836024fd3ca to your computer and use it in GitHub Desktop.
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
// Get the /ws websocket route | |
app.ws('/ws', async function(ws, req) { | |
ws.on('message', async function(msg) { | |
// What was the message? | |
console.log(msg); | |
// Send back some data | |
ws.send(JSON.stringify({ | |
"append" : true, | |
"returnText" : "I am using websockets!" | |
})); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment