A small JavaScript library that decorates the WebSocket API to provide automatic reconnection when the connection is dropped. Current stable version is 1.0.0, released in 2016 with no further updates. It is API compatible with the standard WebSocket, meaning you can replace `new WebSocket('ws://...')` with `new ReconnectingWebSocket('ws://...')` with minimal code changes. Key differentiators include configurable reconnect interval, exponential backoff, and automatic retry until success.
npm install reconnectingwebsocketNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to import and instantiate ReconnectingWebSocket with all options, handling the basic WebSocket events.
Use property callbacks instead of addEventListener.
Check ws.readyState before sending, or implement a manual queue.
If you need binary data as ArrayBuffer, use the native WebSocket or a different library.
Install a WebSocket polyfill like 'ws' and set global.WebSocket before importing ReconnectingWebSocket.
Use `const ReconnectingWebSocket = require('reconnectingwebsocket');` or `import ReconnectingWebSocket from 'reconnectingwebsocket';`No dependency data recorded yet.