Simple protocol for awaitable RPC calls and events over WebSocket connections. Current stable version is 1.14.1, with regular updates. Key differentiators: built-in RPC with automatic promise resolution, event broadcasting to all/single clients, and error handling that passes exceptions across the wire. Supports both server and client usage with a straightforward API. Compared to raw WebSocket or socket.io, it provides a higher-level abstraction for request-response patterns without heavy framework dependencies.
npm install xy-websocketNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a WebSocket server using Koa HTTP server, registers an RPC function 'greet', and broadcasts user count.
Use import { createServer } from 'xy-websocket' (curly braces).Use dynamic import() if in a CJS context, or switch to ESM.
Use import type { Server } from 'xy-websocket' for type annotations.import { createServer } from 'xy-websocket'Use import() or set type: 'module' in package.json.
No dependency data recorded yet.