A lightweight TypeScript Websocket client with built-in keep-alive, auto-reconnect with exponential backoff, and application-level authentication. Designed to work with the `light-websocket-server`. Provides a custom protocol header for ping/pong keep-alive since browser WebSocket API cannot send raw ping frames. Suitable for both browser and Node.js environments when paired with the `ws` package on Node. Version 0.0.45, actively maintained.
npm install light-websocket-clientNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create a WebSocket client with custom options, handle active/inactive events, subscribe to a topic, and connect.
Install 'ws' and either use LightWebsocketNodeClient or subclass LightWebsocketClientImpl with the ws module.
Ensure topics start with '/' and are recognized by the server.
Use client.disconnect() carefully; if you want to temporarily disconnect and reconnect, consider using a flag to manage state.
Pin to a specific version and test upgrades.
Run 'npm install ws' or 'yarn add ws'.
Use import { LightWebsocketNodeClient } from 'light-websocket-client' (curly braces).Verify the server URL and ensure the server is running.