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.1.1 to 0.2.0

3

dist/PersistentWebsocketConnection.d.ts

@@ -26,6 +26,7 @@ import { PersistentWebsocketConnectionOptions } from './types';

private pingPongToleranceTimer;
get isConnected(): boolean;
get isConnecting(): boolean;
constructor(options: PersistentWebsocketConnectionOptions);
send: (data: any) => void;
sendOrQueue: (data: any) => void;
isConnected: () => boolean;
stop: () => void;

@@ -32,0 +33,0 @@ forceReconnect: () => void;

@@ -21,3 +21,3 @@ "use strict";

this.send = (data) => {
if (this.isConnected()) {
if (this.isConnected) {
this.connection.send(data);

@@ -27,3 +27,3 @@ }

this.sendOrQueue = (data) => {
if (this.isConnected()) {
if (this.isConnected) {
this.connection.send(data);

@@ -35,5 +35,2 @@ }

};
this.isConnected = () => {
return this.connection && this.connection.readyState === this.connection.OPEN;
};
this.stop = () => {

@@ -62,3 +59,3 @@ if (this.closedExternally) {

this.reconnect = () => {
if (this.closedExternally || this.isConnected()) {
if (this.closedExternally || this.isConnected) {
this.reconnectingTries = 0;

@@ -81,3 +78,3 @@ this.reconnecting = false;

this.closeConnection = () => {
if (this.connection) {
if (this.connection && (this.isConnected || this.isConnecting)) {
try {

@@ -113,3 +110,3 @@ this.connection.close();

this.pingPongTimer = setTimeout(() => {
if (this.isConnected()) {
if (this.isConnected) {
this.pingPongToleranceTimer = setTimeout(this.handleNoPong, this.pingPongOptions.toleranceTimeout);

@@ -154,3 +151,3 @@ if (!this.pingPongOptions.heartbeatOnly) {

this.closedDuoToPongOrHeartbeatTimeout = false;
this.handleConnectionLost('pong-or-hearbeat-timeout');
this.handleConnectionLost('pong-or-heartbeat-timeout');
}

@@ -206,3 +203,3 @@ else {

}
if (this.initialConnectionEstablished && !this.reconnecting && !this.isConnected()) {
if (this.initialConnectionEstablished && !this.reconnecting && !this.isConnected) {
if (this.reconnectingForcefully) {

@@ -218,3 +215,3 @@ this.logger.debug(`Connection to ${this.url} was forcefully closed.`);

this.closedDuoToPongOrHeartbeatTimeout = false;
this.handleConnectionLost('pong-or-hearbeat-timeout');
this.handleConnectionLost('pong-or-heartbeat-timeout');
}

@@ -251,3 +248,11 @@ else {

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

@@ -19,3 +19,3 @@ import { MessageEvent } from 'ws';

}
export declare type ConnectionLostReason = 'pong-or-hearbeat-timeout' | 'closed-unexpectedly' | 'error';
export declare type ConnectionLostReason = 'pong-or-heartbeat-timeout' | 'closed-unexpectedly' | 'error';
export interface ConnectionLostEvent {

@@ -22,0 +22,0 @@ reason: ConnectionLostReason;

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

@@ -19,16 +19,16 @@ "main": "dist/index.js",

"devDependencies": {
"@typescript-eslint/eslint-plugin": "^2.3.1",
"@typescript-eslint/parser": "^2.3.1",
"eslint": "^6.4.0",
"rimraf": "^3.0.0",
"ts-node": "^8.4.1",
"typescript": "^3.6.3"
"@typescript-eslint/eslint-plugin": "^2.27.0",
"@typescript-eslint/parser": "^2.27.0",
"eslint": "^6.8.0",
"rimraf": "^3.0.2",
"ts-node": "^8.8.2",
"typescript": "^3.8.3"
},
"dependencies": {
"@types/node": "^12.7.5",
"@types/ws": "^6.0.3",
"@types/node": "^13.11.1",
"@types/ws": "^7.2.3",
"isomorphic-ws": "^4.0.1",
"tslib": "^1.10.0",
"ws": "^7.1.2"
"tslib": "^1.11.1",
"ws": "^7.2.3"
}
}
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