A WebSocket client wrapper library with auto-reconnect (exponential backoff), heartbeat mechanism, message queue, and Emittery-based event system. Version 2.0.5, stable with monthly releases. Key differentiators: full TypeScript support, enum-based event names for type safety, configurable heartbeat and reconnect strategies, and built-in message buffering during disconnection. Requires peer dependency Emittery ^1.2.0.
npm install cy-plugin-websocketNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows creation of SocketClient with advanced config, connection, event handling using enumSocketEvent, sending a message, and closing the connection.
Use named import: import { SocketClient } from 'cy-plugin-websocket'Use enumSocketEvent.OPEN instead of 'open' for type safety and compatibility
Use enumSocketEvent for event names
Install emittery@1.2.0 as a dependency: npm install emittery@1.2.0 --save
No extra @types package needed; types are included in the package
Install emittery@1.2.0: npm install emittery@1.2.0
Use named import: import { SocketClient } from 'cy-plugin-websocket'Install package: npm install cy-plugin-websocket; ensure tsconfig.json includes node module resolution
Call socket.connect() before adding event listeners