@khromkov/rws
v0.1.0
Published
reconnecting-websocket
Downloads
9
Readme
RWS - lib for auto reconnect dropped WebSocket connection. It has almost same api as WebSocket. So you can just replace WebSocket to RWS in your code for default behavior.
const ws = RWS('ws://url', 'protocols', options);
Options
- reconnectDelay (number) - timeout reconnect after drop. default: 0
- reconnectDelayFactor (number) - increase delay factor for next reconnect, no effect for reconnectDelay === 0. default: 1
- reconnectMaxCount (number) - max reconnect count. default: Infinity.
- shouldReconnect (function(event: CloseEvent): bool) - if it is defined invoke before reconnect with last close args. If return false, reconnection does not occur.