// the find
websockets/ws
Simple to use, blazing fast and thoroughly tested WebSocket client and server for Node.js
ws is the de-facto WebSocket implementation for Node.js — a low-level, zero-dependency client and server that passes the full Autobahn test suite. It's what Socket.IO and dozens of other libraries sit on top of, so you're almost certainly already using it indirectly. Target audience is anyone building real-time Node.js servers who wants control over the wire protocol without a framework on top.
Full RFC 6455 compliance validated by the Autobahn suite, not just manual testing. The permessage-deflate implementation is genuinely configurable down to zlib window bits and concurrency limits, which matters at scale. The `noServer` mode plus manual `handleUpgrade` makes it easy to multiplex multiple WebSocket namespaces over one HTTP server without any magic routing layer. Optional `bufferutil` native addon improves frame masking/unmasking performance and is purely opt-in — the pure-JS fallback works fine.
The broadcast pattern (iterating `wss.clients` in a forEach) is O(n) with no built-in rooms or channels — you build that yourself, and at 10k+ connections it becomes your problem. Permessage-deflate has a documented Node.js/zlib memory fragmentation bug on Linux under high concurrency that the README itself warns about but doesn't solve. The heartbeat/ping-pong mechanism for detecting broken connections requires manual implementation with a setInterval and per-socket state; there's no built-in keepalive option. No TypeScript types in the package itself — you need `@types/ws` from DefinitelyTyped, which occasionally lags behind API changes.