websocket.js
WebSocket browser client with reconnect back-off feature.
Usage
WebSocketClient
behaves exactly in the same way as WebSocket
.
It accepts an optional third parameter, which is used to configure
backoff feature.
var conn = new WebSocketClient('ws://' + host + ':8080', null, {
strategy: "fibonacci",
randomisationFactor: 0,
initialDelay: 10,
maxDelay: 300
});
var conn = new WebSocketClient('ws://' + host + ':8080', null, {
strategy: "exponential",
randomisationFactor: 0,
initialDelay: 10,
maxDelay: 300,
factor: 3
});
Event Listeners
- onclose
- onerror
- onmessage
- onopen
- onreconnect
License
MIT