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

@aurox/persistent-websocket-connection

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aurox/persistent-websocket-connection - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

1

dist/defaults.js

@@ -50,2 +50,3 @@ "use strict";

onReconnecting: options.onReconnecting || noop,
onConnecting: options.onConnecting || noop,
onConnectionLost: options.onConnectionLost || noop,

@@ -52,0 +53,0 @@ };

@@ -22,2 +22,3 @@ import { PersistentWebsocketConnectionOptions } from './types';

private onReconnecting;
private onConnecting;
private onConnectionLost;

@@ -24,0 +25,0 @@ private queuedDataToSendOnReconnect;

20

dist/PersistentWebsocketConnection.js

@@ -8,2 +8,3 @@ "use strict";

constructor(options) {
this.connection = null;
this.attemptingToEstablishConnection = false;

@@ -25,9 +26,11 @@ this.closedExternally = false;

this.send = (data) => {
var _a;
if (this.isConnected) {
this.connection.send(data);
(_a = this.connection) === null || _a === void 0 ? void 0 : _a.send(data);
}
};
this.sendOrQueue = (data) => {
var _a;
if (this.isConnected) {
this.connection.send(data);
(_a = this.connection) === null || _a === void 0 ? void 0 : _a.send(data);
}

@@ -169,2 +172,3 @@ else {

this.handleOpen = () => {
var _a;
this.attemptingToEstablishConnection = false;

@@ -189,3 +193,3 @@ this.reconnectingForcefully = false;

for (const data of queue) {
this.connection.send(data);
(_a = this.connection) === null || _a === void 0 ? void 0 : _a.send(data);
}

@@ -279,2 +283,3 @@ }

this.connection = new isomorphic_ws_1.default(this.url);
this.onConnecting(this.connection);
this.connection.onopen = this.handleOpen;

@@ -296,2 +301,3 @@ this.connection.onmessage = this.handleMessage;

this.onReconnecting = optionsWithDefaults.onReconnecting;
this.onConnecting = optionsWithDefaults.onConnecting;
this.onConnectionLost = optionsWithDefaults.onConnectionLost;

@@ -302,10 +308,10 @@ this.connect();

get isConnected() {
var _a;
return ((_a = this.connection) === null || _a === void 0 ? void 0 : _a.readyState) === this.connection.OPEN;
var _a, _b;
return ((_a = this.connection) === null || _a === void 0 ? void 0 : _a.readyState) === ((_b = this.connection) === null || _b === void 0 ? void 0 : _b.OPEN);
}
get isConnecting() {
var _a;
return ((_a = this.connection) === null || _a === void 0 ? void 0 : _a.readyState) === this.connection.CONNECTING;
var _a, _b;
return ((_a = this.connection) === null || _a === void 0 ? void 0 : _a.readyState) === ((_b = this.connection) === null || _b === void 0 ? void 0 : _b.CONNECTING);
}
}
exports.default = PersistentWebsocketConnection;

@@ -1,2 +0,2 @@

import { MessageEvent } from 'ws';
import WebSocket, { MessageEvent } from 'ws';
export interface PersistentWebsocketConnectionPingPongOptions {

@@ -38,2 +38,3 @@ enabled: boolean;

onReconnecting?: (tries: number) => void;
onConnecting?: (connection: WebSocket) => void;
onConnectionLost?: (event: ConnectionLostEvent) => void;

@@ -40,0 +41,0 @@ reconnectTimeout?: number;

{
"name": "@aurox/persistent-websocket-connection",
"version": "0.3.1",
"version": "0.3.2",
"description": "Aurox Persistent Websocket Connection",

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

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