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.3.2 to 1.4.0

9

build/index.js

@@ -136,5 +136,8 @@ "use strict";

connect();
this.close = function () {
shouldRetry = false;
ws.close();
this.close = function (code, reason, keepClosed) {
if (code === void 0) { code = 1000; }
if (reason === void 0) { reason = ''; }
if (keepClosed === void 0) { keepClosed = false; }
shouldRetry = !keepClosed;
ws.close(code, reason);
};

@@ -141,0 +144,0 @@ this.addEventListener = function (type, listener, options) {

@@ -155,5 +155,5 @@ type Options = {

this.close = () => {
shouldRetry = false;
ws.close();
this.close = (code = 1000, reason = '', keepClosed = false) => {
shouldRetry = !keepClosed;
ws.close(code, reason);
};

@@ -160,0 +160,0 @@

{
"name": "reconnecting-websocket",
"version": "1.3.2",
"version": "1.4.0",
"description": "Reconnecting WebSocket",

@@ -5,0 +5,0 @@ "main": "build/index.js",

@@ -67,3 +67,3 @@ # Reconnecting WebSocket

const defaultOptions = {
constructor: (typeof WebSocket === 'function') ? WebSocket : null,
constructor: isGlobalWebSocket() ? WebSocket : null,
maxReconnectionDelay: 10000,

@@ -87,2 +87,12 @@ minReconnectionDelay: 1500,

#### Manually closing
The `close` function has an additional optional parameter `keepClosed`.
```javascript
close(code = 1000, reason = '', keepClosed = false)
```
Use the `keepClosed` parameter to keep the WebSocket closed or automatically reconnect.
#### Using alternative constructor

@@ -89,0 +99,0 @@

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