Shopify ReconnectingWebSocket

JSON →
library 0.1.0 ·javascript maintenance
verified Jun 7, 2026

A lightweight (<600 bytes gzipped) drop-in replacement for the native WebSocket API that automatically reconnects when the connection drops. Version 0.1.0 is a fork of the original reconnecting-websocket library, updated to track the latest master branch. It is API-compatible with WebSocket, so you can replace 'new WebSocket(url)' with 'new ReconnectingWebSocket(url)' and get automatic reconnection with exponential backoff (configurable via options like reconnectInterval, maxReconnectInterval, reconnectDecay). It supports all standard WebSocket events (onopen, onmessage, onclose, onerror) and methods (send, close). Compared to alternatives, it is minimal and has no dependencies, but note that this fork may not see active maintenance.