Skip to content

Instantly share code, notes, and snippets.

View Kenshirosan's full-sized avatar

Laurent Neveux Kenshirosan

View GitHub Profile
@Kenshirosan
Kenshirosan / ws.js
Created October 23, 2022 09:40 — 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) {