A reconnecting WebSocket client that is isomorphic (works in browser and Node.js). Version 1.0.1 provides a WebSocket API-compatible wrapper with automatic reconnection, configurable backoff strategies (Fibonacci, exponential), pings to keep connections alive, and timeouts for idle connections. Unlike similar libraries like reconnecting-websocket, it exposes all standard WebSocket properties and methods directly, making it a drop-in replacement. The package is stable with no recent releases, suitable for applications needing persistent WebSocket connections with minimal overhead.
npm install forever-websocketNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a ForeverWebSocket instance with reconnection, timeout, and ping options.
Use import { ForeverWebSocket } from 'forever-websocket' or const { ForeverWebSocket } = require('forever-websocket').Install 'ws' as a dependency: npm install ws.
Set randomizeDelay to a number like 0.5 for 50% randomization.
Leave pingFrame as false unless you know the server supports RFC 6455 ping frames.
Use const { ForeverWebSocket } = require('forever-websocket');Install ws: npm install ws
Ensure your bundler uses the browser build of forever-websocket; the package is isomorphic and should auto-detect.