Build a real-time chat server in Node.js where users receive new messages instantly without refreshing the page.
Create a live game backend where the server pushes score updates and game state to all connected players simultaneously.
Run WebSocket logic on the server using the same browser-style WebSocket API you already know, minimising code changes.
Set up automatic ping frames to keep idle WebSocket connections alive through firewalls and proxies.
Install with one npm command, no system-level dependencies beyond Node.js.
WebSocket-Node is a JavaScript library for Node.js that implements the WebSocket protocol, which is a standard way to keep a live, two-way connection open between a server and a client. Normally, when a browser talks to a server it sends a request, gets a response, and the connection closes. WebSocket flips that model: once connected, both sides can send messages to each other at any time without starting a new request. This library brings that capability to server-side JavaScript running in Node. The library handles both sides of a WebSocket conversation. You can use it to build a server that accepts incoming connections and responds to messages, or a client that connects to an existing WebSocket server. It supports the two protocol versions still in active use today, versions 8 and 13, and passes the Autobahn test suite, an industry-standard compliance checker for WebSocket implementations. Installing it takes one command in your project folder. Once installed, you import the pieces you need: a server class, a client class, and optionally a router that lets you attach different handlers to different URL paths or protocol names. The library also provides a W3CWebSocket class that mirrors the WebSocket API browsers expose natively, so code written for the browser can run in Node with minimal changes. Several settings are adjustable at runtime. You can cap how large an incoming message is allowed to be, control whether outgoing messages get split into smaller fragments, turn on automatic ping frames to keep idle connections alive, and decide how long to wait for a clean close acknowledgment before cutting the socket. TLS encryption is supported for both client connections and server setups when you pass an HTTPS server instance instead of a plain HTTP one. The library is published under the Apache 2.0 license. It supports all current browsers including Firefox 10 and later, Chrome 16 and later, Internet Explorer 10 and later, and Safari 6 and later on the client side. The project notes that user-provided protocol extensions are not yet supported.
← theturtle32 on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.