A lightweight Node.js module that provides automatic reconnection for websocket-streams when the connection drops. Based on reconnect-core, it wraps websocket-stream to create a persistent stream that reconnects on failure. Version 0.1.0 is the latest release; the package has seen no updates since 2013 and should be considered in maintenance mode. It is a thin wrapper around websocket-stream and depends on both ws and websocket-stream. Compared to alternatives like reconnecting-websocket, it uses the stream API which may be preferable in streaming contexts but is less flexible for non-stream usage.
npm install reconnect-wsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a WebSocket server and a client that automatically reconnects using reconnect-ws.
Use reconnect({ host: 'example.com', port: 8080 }) for remote hosts.Use .on('connect', function(stream) { ... }) to ensure connection is established.Ensure your environment uses Node.js with 'ws' installed.
Consider migrating to a maintained alternative like 'reconnecting-websocket' or implement a custom reconnection layer.
npm install websocket-stream ws
Use const reconnect = require('reconnect-ws');reconnect(function(stream) { ... }); always provide a callback.