WebSocket abstraction for server and client with built-in heartbeat, request/response RPC protocol, and connection quality tracking. Part of the inSite stack, designed for seamless integration with insite-ws-transfers, insite-users-server-ws, and other inSite packages. Current stable version is 2.4.0. Release cadence is not actively maintained. The package provides three entry points: insite-ws/server for Node.js, insite-ws/client for browser/Bun, and insite-ws/client/node for Node.js with ws polyfill. Key differentiators: message format uses JSON arrays, built-in request/response RPC with `~r-q`/`~r-s` kinds, heartbeat at 5-second intervals, and auto-reconnect on client side. The server supports SSL, custom client classes, and event-based message handling. Requires Node.js >=20.0.0.
npm install insite-wsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create a WebSocket server with a request handler, connect a client, send an RPC request, and get a response.
Upgrade Node.js to version 20 or higher.
In Node.js, import from 'insite-ws/client/node' instead of 'insite-ws/client'.
Avoid using message kinds that start with '~r-' in your application logic, as they are reserved for internal RPC.
Run 'npm install insite-ws' and ensure you use the correct subpath import: 'insite-ws/server'.
Change import to 'insite-ws/client/node' which polyfills WebSocket using the 'ws' package.
Use import syntax (import { ... } from 'insite-ws/server') or set type: 'module' in your package.json.