reconnecting-websocket
Advanced tools
Comparing version 1.4.4 to 2.0.0
@@ -137,6 +137,9 @@ "use strict"; | ||
connect(); | ||
this.close = function (code, reason, keepClosed) { | ||
this.close = function (code, reason, _a) { | ||
if (code === void 0) { code = 1000; } | ||
if (reason === void 0) { reason = ''; } | ||
if (keepClosed === void 0) { keepClosed = false; } | ||
var _b = _a === void 0 ? {} : _a, _c = _b.keepClosed, keepClosed = _c === void 0 ? false : _c, _d = _b.delay, delay = _d === void 0 ? 0 : _d; | ||
if (delay) { | ||
reconnectDelay = delay; | ||
} | ||
shouldRetry = !keepClosed; | ||
@@ -143,0 +146,0 @@ ws.close(code, reason); |
@@ -156,3 +156,6 @@ type Options = { | ||
this.close = (code = 1000, reason = '', keepClosed = false) => { | ||
this.close = (code = 1000, reason = '', {keepClosed = false, delay = 0} = {}) => { | ||
if (delay) { | ||
reconnectDelay = delay; | ||
} | ||
shouldRetry = !keepClosed; | ||
@@ -159,0 +162,0 @@ ws.close(code, reason); |
{ | ||
"name": "reconnecting-websocket", | ||
"version": "1.4.4", | ||
"version": "2.0.0", | ||
"description": "Reconnecting WebSocket", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -88,9 +88,10 @@ # Reconnecting WebSocket | ||
The `close` function has an additional optional parameter `keepClosed`. | ||
The `close` function has an additional options parameter | ||
```javascript | ||
close(code = 1000, reason = '', keepClosed = false) | ||
close(code = 1000, reason = '', {keepClosed: boolean, delay: number}) | ||
``` | ||
Use the `keepClosed` parameter to keep the WebSocket closed or automatically reconnect. | ||
- Use the `keepClosed` option to keep the WebSocket closed or automatically reconnect (default `false`). | ||
- Use the `delay` options to set the initial delay for the next connection retry (ignored if `0`). | ||
@@ -97,0 +98,0 @@ #### Using alternative constructor |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
71782
773
131