Last active
March 24, 2021 05:00
Revisions
-
nsubrahm-aws revised this gist
Mar 24, 2021 . 1 changed file with 13 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ const http = require('http'); const WebSocket = require('ws'); const server = http.createServer(); const wss = new WebSocket.Server({ noServer: true }); server.on('upgrade', (request, socket, head) => { wss.handleUpgrade(request, socket, head, function done(w) { wss.emit('connection', ws, request) }) }) server.listen(8080) -
chainhead created this gist
Mar 24, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ # Introduction This gist shows a basic implementation of a HTTP server that handles the request to upgrade connection to Websockets.