ws: WebSocket client and server for Node.js
WebSocket client and server for Node.js with RFC 6455 support and compression.
Learn more about ws
ws is a WebSocket library that implements the RFC 6455 WebSocket protocol for Node.js applications. It provides both client and server classes that handle WebSocket connections, message framing, and protocol negotiation. The library supports optional extensions like permessage-deflate compression and can integrate with existing HTTP/HTTPS servers. It is commonly used for real-time communication in web applications, chat systems, and live data streaming.
Protocol Compliance
Implements RFC 6455 WebSocket standard and passes the comprehensive Autobahn test suite for both client and server functionality.
Optional Performance
Supports bufferutil binary addon for improved frame masking performance and utf-8-validate for text validation on older Node.js versions.
Compression Support
Includes permessage-deflate extension with configurable parameters for message compression, though disabled by default on servers due to performance overhead.
import { WebSocketServer } from 'ws';
const wss = new WebSocketServer({ port: 8080 });
wss.on('connection', function connection(ws) {
ws.on('error', console.error);
ws.on('message', function message(data) {
console.log('received: %s', data);
});
ws.send('something');
});8.19.0: Added the `closeTimeout` option (#2308).
- –Added the `closeTimeout` option (#2308).
- –Handled a forthcoming breaking change in Node.js core (19984854).
to the HTTP response if the client requested version was either invalid or
- –Fixed a spec violation where the `Sec-WebSocket-Version` header was not added
exceeded, led to the emission of an inaccurate error and closure of the
- –Fixed an issue that, during message decompression when the maximum size was
Top in Networking
Related Repositories
Discover similar tools and frameworks used by developers
proxychains
Force TCP connections through chained SOCKS/HTTP proxies via LD_PRELOAD.
Envoy
Cloud-native edge and service proxy with advanced load balancing, observability, and security features.
nginx-proxy-manager
Web UI for Nginx reverse proxy and SSL management.
ByeDPI Android
Android app that bypasses DPI and network censorship using a local VPN with SOCKS5 proxy, no root required.
youtubeUnblock
Linux tool that bypasses YouTube access restrictions by manipulating SNI in network traffic.