Implementing the WebSocket protocol from scratch using Node.js