Fast JSON-RPC 2.0 WebSocket client written in TypeScript. Version 1.1.4 is the latest stable release (no recent updates). It provides async-await Promise-based RPC calls and notifications over WebSocket with automatic unique request IDs generated by uuid/v1. Key differentiators: lightweight, close-to-metal design for performance, optional noRpc() mode to skip JSON-RPC overhead, and ability to attach to an existing WebSocket instance (useful with Apollo GraphQL or REST libraries). Focuses on simplicity and TypeScript support, unlike alternatives like rpc-websockets which lack TypeScript declarations. Suitable for Node.js (>=6) and modern browsers with WebSocket.
npm install rpc-websocket-clientNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create an RPC client, connect, make a call with error handling, send a notification, and close.
Always call rpc.listenMessages() after rpc.changeSocket(newWs).
Use .catch() or try/catch around await rpc.call(...).
Use rpc.close() instead of directly closing the underlying WebSocket.
Ensure the client is connected before calling notify, or wrap in try/catch.
Use import { RpcWebSocketClient } from 'rpc-websocket-client' instead of import RpcWebSocketClient from 'rpc-websocket-client'.Always await rpc.connect() before making calls.
Add a .catch() handler to rpc.call() or use try/catch.