New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@d-fischer/connection

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@d-fischer/connection - npm Package Compare versions

Comparing version 6.4.1 to 6.4.2

2

lib/DirectConnection.d.ts
import { AbstractConnection } from './AbstractConnection';
export declare class DirectConnection extends AbstractConnection {
private _socket?;
private _socket;
get port(): number;

@@ -5,0 +5,0 @@ get hasSocket(): boolean;

@@ -11,3 +11,5 @@ "use strict";

function DirectConnection() {
return _super !== null && _super.apply(this, arguments) || this;
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._socket = null;
return _this;
}

@@ -74,2 +76,9 @@ Object.defineProperty(DirectConnection.prototype, "port", {

}
if (_this._socket) {
_this._socket.removeAllListeners('connect');
_this._socket.removeAllListeners('error');
_this._socket.removeAllListeners('data');
_this._socket.removeAllListeners('close');
_this._socket = null;
}
});

@@ -87,9 +96,12 @@ })];

return [2 /*return*/, new Promise(function (resolve) {
var _a;
var listener = _this.onDisconnect(function () {
listener.unbind();
if (_this._socket) {
var listener_1 = _this.onDisconnect(function () {
listener_1.unbind();
resolve();
});
_this._socket.end();
}
else {
resolve();
});
(_a = _this._socket) === null || _a === void 0 ? void 0 : _a.end();
_this._socket = undefined;
}
})];

@@ -96,0 +108,0 @@ });

@@ -156,12 +156,14 @@ "use strict";

return tslib_1.__awaiter(this, void 0, void 0, function () {
var lastConnection;
return tslib_1.__generator(this, function (_b) {
switch (_b.label) {
case 0:
(_a = this._logger) === null || _a === void 0 ? void 0 : _a.trace('PersistentConnection disconnect');
(_a = this._logger) === null || _a === void 0 ? void 0 : _a.trace("PersistentConnection disconnect currentConnectionExists:" + Boolean(this._currentConnection).toString() + " connecting:" + this._connecting.toString());
this._connecting = false;
if (!this._currentConnection) return [3 /*break*/, 2];
return [4 /*yield*/, this._currentConnection.disconnect()];
lastConnection = this._currentConnection;
this._currentConnection = undefined;
return [4 /*yield*/, lastConnection.disconnect()];
case 1:
_b.sent();
this._currentConnection = undefined;
_b.label = 2;

@@ -180,9 +182,6 @@ case 2: return [2 /*return*/];

return tslib_1.__awaiter(this, void 0, void 0, function () {
var _this = this;
return tslib_1.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.disconnect()];
case 1:
_a.sent();
return [2 /*return*/, this.connect()];
}
void this.disconnect().catch(function (e) { var _a; return (_a = _this._logger) === null || _a === void 0 ? void 0 : _a.error("Error while disconnecting for the reconnect: " + e.message); });
return [2 /*return*/, this.connect()];
});

@@ -189,0 +188,0 @@ });

@@ -7,3 +7,3 @@ import type { ClientOptions } from 'ws';

export declare class WebSocketConnection extends AbstractConnection<WebSocketConnectionOptions> {
private _socket?;
private _socket;
get port(): number;

@@ -10,0 +10,0 @@ get hasSocket(): boolean;

@@ -10,3 +10,5 @@ "use strict";

function WebSocketConnection() {
return _super !== null && _super.apply(this, arguments) || this;
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._socket = null;
return _this;
}

@@ -78,2 +80,9 @@ Object.defineProperty(WebSocketConnection.prototype, "port", {

}
if (_this._socket) {
_this._socket.onopen = null;
_this._socket.onmessage = null;
_this._socket.onerror = null;
_this._socket.onclose = null;
_this._socket = null;
}
};

@@ -91,9 +100,12 @@ })];

return [2 /*return*/, new Promise(function (resolve) {
var _a;
var listener = _this.onDisconnect(function () {
listener.unbind();
if (_this._socket) {
var listener_1 = _this.onDisconnect(function () {
listener_1.unbind();
resolve();
});
_this._socket.close();
}
else {
resolve();
});
(_a = _this._socket) === null || _a === void 0 ? void 0 : _a.close();
_this._socket = undefined;
}
})];

@@ -100,0 +112,0 @@ });

{
"name": "@d-fischer/connection",
"version": "6.4.1",
"version": "6.4.2",
"description": "Abstraction for packet-based connections.",

@@ -5,0 +5,0 @@ "keywords": [],

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

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

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