@d-fischer/connection
Advanced tools
Comparing version 8.0.0 to 8.0.1
@@ -11,2 +11,3 @@ /// <reference types="ws" /> | ||
private readonly _url; | ||
private _closingOnDemand; | ||
constructor(target: ConnectionTarget, options?: ConnectionOptions<WebSocketConnectionOptions>); | ||
@@ -13,0 +14,0 @@ get hasSocket(): boolean; |
@@ -10,2 +10,3 @@ "use strict"; | ||
this._socket = null; | ||
this._closingOnDemand = false; | ||
if (target.hostName && target.port) { | ||
@@ -51,6 +52,8 @@ this._url = `ws${target.secure ? 's' : ''}://${target.hostName}:${target.port}`; | ||
const wasConnected = this._connected; | ||
(_a = this._logger) === null || _a === void 0 ? void 0 : _a.trace(`WebSocketConnection onClose wasConnected:${wasConnected.toString()} wasClean:${e.wasClean.toString()}`); | ||
const wasConnecting = this._connecting; | ||
(_a = this._logger) === null || _a === void 0 ? void 0 : _a.trace(`WebSocketConnection onClose wasConnected:${wasConnected.toString()} wasConnecting:${wasConnecting.toString()} closingOnDemand:${this._closingOnDemand.toString()} wasClean:${e.wasClean.toString()}`); | ||
this._connected = false; | ||
this._connecting = false; | ||
if (e.wasClean) { | ||
if (e.wasClean || this._closingOnDemand) { | ||
this._closingOnDemand = false; | ||
this.emit(this.onDisconnect, true); | ||
@@ -76,2 +79,3 @@ this.emit(this.onEnd, true); | ||
(_a = this._logger) === null || _a === void 0 ? void 0 : _a.trace('WebSocketConnection disconnect'); | ||
this._closingOnDemand = true; | ||
(_b = this._socket) === null || _b === void 0 ? void 0 : _b.close(); | ||
@@ -78,0 +82,0 @@ } |
{ | ||
"name": "@d-fischer/connection", | ||
"version": "8.0.0", | ||
"version": "8.0.1", | ||
"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
68105
891