Zerva WebSocket is a lightweight, resilient WebSocket module for the Zerva event-driven server framework. Version 0.3.5 provides plain WebSocket connections with automatic reconnection, heartbeat (ping/pong), and supports three communication patterns: raw binary channels (via Zeed Channel), typed message interfaces (via Zeed Message), and PubSub. It is designed for Node.js (>=14.13.1) with full TypeScript support. Key differentiators include transparent reconnection that preserves the same channel object, binary-first encoding with pluggable codecs, and tight integration with Zeed's messaging primitives. Ideal for applications needing simple, reliable WebSocket communication without the overhead of Socket.IO.
npm install zerva-websocketNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up a WebSocket server using Zerva, listens for connections, echoes messages via MessageHub, and connects from client side.
Always pass a full URL to the WebSocketConnection constructor when running in Node.js, e.g., new WebSocketConnection('ws://localhost:8080').Ensure useHttp() is called before useWebSocket().
import { on } from 'zerva'Set 'moduleResolution' to 'node' (or 'nodenext') in tsconfig.json.
npm install zerva-websocket
import { on } from 'zerva'Call useHttp() before useWebSocket()