Created
November 16, 2018 14:27
-
-
Save Srushtika/4e1d8af6fb43c4d9feb22ad587789f0b to your computer and use it in GitHub Desktop.
WebSockets server tutorial
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
server.on('upgrade', (req, socket) => { | |
// Make sure that we only handle WebSocket upgrade requests | |
if (req.headers['upgrade'] !== 'websocket') { | |
socket.end('HTTP/1.1 400 Bad Request'); | |
return; | |
} | |
// More to come… | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment