WebSocket transport layer for the Mole-RPC JSON-RPC 2.0 library. Current version 1.0.3, stable and feature-complete. Works in Node.js (>=10.0.0), browser, and Electron. Supports client-to-server, server-to-client, and bidirectional communication. Peer dependencies: mole-rpc 1.* and ws 8.*. Alternative transports exist for HTTP, TCP, etc.
npm install mole-rpc-transport-wsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic setup of a Mole-RPC server and client over WebSocket, with a ping/pong example.
Pass { wss: new WebSocketServer({ port }) } instead of { url } for server transport.Install ws@8: npm install ws@8
Install mole-rpc@1: npm install mole-rpc@1
Use a bundler that can handle CommonJS modules (e.g., Webpack with node: false).
Ensure you pass 'url' for client or 'wss' for server, not WebSocket instance directly.
Run 'npm install ws@8' in your project.
Use Webpack/Rollup/Parcel to bundle the module.