A lightweight TypeScript-first WebSocket wrapper that provides automatic reconnection with exponential backoff and persistent offline message buffering via IndexedDB. Current stable version is 0.1.0, released as an early-stage package with limited API surface. Key differentiators include built-in offline support for medical and field applications, TypeScript type definitions bundled, and support for multiple message types (string, ArrayBuffer, Uint8Array, Blob). Unlike alternatives like reconnecting-websocket, this library persists messages in IndexedDB for later delivery when offline.
npm install reliable-websocketNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows minimal setup: create ReliableWebSocket instance with URL and callbacks, connect, send a message, and close the connection.
Set 'type':'module' in package.json or rename importing file to .mjs. Alternatively, use dynamic import() with CJS.
Replace 'reconnectDelay' with 'reconnectInterval' in options.
Monitor storage quota or use wrapper that handles quota errors. Alternative: set bufferSizeLimit option.
Check for IndexedDB and WebSocket support before using, or apply a polyfill.
If you relied on fixed interval, set 'reconnectInterval' and optionally set 'backoffMultiplier: 1'.
Use import { ReliableWebSocket } from 'reliable-websocket'Use a browser that supports IndexedDB, or disable offline buffering by passing options:{ useIndexedDB: false }Ensure your page protocol matches WebSocket protocol (http/wss or https/wss, or use same protocol)
Use import syntax or switch to 'type':'module' in package.json and use dynamic import()