Skip to content

Instantly share code, notes, and snippets.

@karenpeng
Last active March 20, 2019 18:38
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 karenpeng/44fb812b88d05ae544c6d882f7a9f254 to your computer and use it in GitHub Desktop.
Save karenpeng/44fb812b88d05ae544c6d882f7a9f254 to your computer and use it in GitHub Desktop.
// example below is using express and express-ws
app.ws('/websocket', (ws, req) => {
ws.on('message', (msg) => {
if (msg === 'A') {
ws.send('9');
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment