A simple yet modern WebSocket client for JavaScript/TypeScript. Current stable version is 2.2.2. It provides a clean API with event-based message handling, automatic reconnection, heartbeat support, and TypeScript generics for strongly-typed messages. Ships with server-side utilities for heartbeat protocol. Released under MIT license. Lightweight alternative to heavier WebSocket libraries.
npm install wsheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a WebSocket connection with TypeScript generics, sends typed messages, and subscribes to events with payload typing.
Ensure you install 'wshe' specifically, not 'ws'. Check package.json dependencies.
Use import { ... } from 'wshe/server' for server-side heartbeat helpers.Set immediate: true or call wshe.connect() explicitly.
Ensure your environment supports package.json 'exports' field. For older Node.js versions (<12), add 'wshe/server' to the 'paths' in tsconfig or use a polyfill.
Use named import: import { createWSHE } from 'wshe' and call createWSHE to get the instance.No dependency data recorded yet.