A WebSocket transport library for JSON-RPC that enables asynchronous bidirectional requests and responses over WebSocket connections. Version 7.0.1 supports Node.js and browser environments via separate entry points. It provides a simple API with server and client creation, method exposure, and callback-based request/response handling. Key differentiators: uses the popular 'ws' library for Node, supports both server and client in one package, and offers a lightweight abstraction over raw WebSocket messaging.
npm install json-rpc-wsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows server creation, method exposure, and callbacks for request/response over WebSocket.
import { ... } from 'json-rpc-ws/browser' in browser environments.Install 'ws' alongside: npm install ws json-rpc-ws
Always call reply exactly once with either error or reply as non-null, not both.
npm install ws
Use 'json-rpc-ws/browser' in browser code.
Use a different method name or remove the existing handler first.