Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

reconnecting-websocket

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reconnecting-websocket - npm Package Compare versions

Comparing version 1.4.4 to 2.0.0

7

build/index.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc