reconnecting-websocket
Advanced tools
Comparing version 3.0.2 to 3.0.3
{ | ||
"name": "reconnecting-websocket", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Reconnecting WebSocket", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -13,3 +13,3 @@ # Reconnecting WebSocket | ||
- Reassign event listeners when a new WebSocket instance is created | ||
- Automatic reconnection using rfc6455 guidelines | ||
- Automatic reconnection using [rfc6455](https://tools.ietf.org/html/rfc6455#section-7.2.3) guidelines | ||
- Handle connection timeouts | ||
@@ -85,3 +85,3 @@ - Full test coverage | ||
const options = {connectionTimeout: 1000}; | ||
const ws = new WebSocket('ws://my.site.com', null, options); | ||
const ws = new WebSocket('ws://my.site.com', [], options); | ||
``` | ||
@@ -101,2 +101,13 @@ | ||
#### Setting WebSocket options | ||
If you set any attributes of WebSocket itself, such as `binaryType`, make sure to set them again after each reconnection, i.e. on the `open` event: | ||
```javascript | ||
ws.addEventListener('open', () => { | ||
ws.binaryType = 'arraybuffer'; | ||
ws.send('i am ready to receive some data!'); | ||
}); | ||
``` | ||
#### Using alternative constructor | ||
@@ -103,0 +114,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21832
144