ws-rpc is a lightweight RPC extension for the ws WebSocket server, enabling named message types and callback-based communication for server and client. Version 0.0.8 is the latest release, with no recent updates (low activity). It provides room/channel support, client disconnect auto-removal, and integration with Express and Flash client shims. Unlike raw ws, it adds structured RPC patterns on top, but binary messages are handled separately.
npm install ws-rpcNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic server setup with Express, ws, and ws-rpc: create room, handle connect, message, disconnect, error events.
Migrate to Socket.IO or use ws directly with JSON messages.
Handle binary messages separately using the classic ws API on 'message' event with flags.
Use wss.on('connect', ...) for ws-rpc, and wss.on('connection', ...) only when bypassing RPC.Use const wsrpc = require('ws-rpc').extend(wss); not require('ws-rpc')(wss);Include <script src='/ws-rpc-client.min.js'></script> before your client code.
Ensure no other process uses the same port, or use app.listen(port, callback).