Navigate:
~$WS0.1%

ws: WebSocket client and server for Node.js

WebSocket client and server for Node.js with RFC 6455 support and compression.

LIVE RANKINGS • 03:09 AM • STEADY
OVERALL
#359
150
NETWORKING
#16
3
30 DAY RANKING TREND
ovr#359
·Netwo#16
STARS
22.7K
FORKS
2.5K
7D STARS
+13
7D FORKS
+2
See Repo:
Share:

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.

ws

1

Protocol Compliance

Implements RFC 6455 WebSocket standard and passes the comprehensive Autobahn test suite for both client and server functionality.

2

Optional Performance

Supports bufferutil binary addon for improved frame masking performance and utf-8-validate for text validation on older Node.js versions.

3

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');
});


v8.19.0

8.19.0: Added the `closeTimeout` option (#2308).

  • Added the `closeTimeout` option (#2308).
  • Handled a forthcoming breaking change in Node.js core (19984854).
v8.18.3

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
v8.18.2

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


[ EXPLORE MORE ]

Related Repositories

Discover similar tools and frameworks used by developers