Skip to content

Instantly share code, notes, and snippets.

View WORMSS's full-sized avatar

WORMSS WORMSS

View GitHub Profile
@WORMSS
WORMSS / ws.js
Last active June 26, 2023 08:59 — forked from tabjy/ws.js
WebSocket from scratch. In Node.js
const http = require('http')
const crypto = require('crypto')
const server = http.createServer((req, res) => {
console.log('got request', req.url)
res.writeHead(200, { 'Content-Type': 'text/plain' })
res.end('okay')
})
server.on('upgrade', function (req, socket) {