From 49871317833ed02380a676122011403f1c5b8b9d Mon Sep 17 00:00:00 2001 From: Gus Narea Date: Mon, 19 Oct 2020 23:21:41 +0100 Subject: [PATCH] fix(parcel collection): Send error codes to server when necessary --- src/lib/PoWebClient.ts | 6 +----- src/lib/_websocketUtils.ts | 4 ---- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/lib/PoWebClient.ts b/src/lib/PoWebClient.ts index 4614294e..06794c26 100644 --- a/src/lib/PoWebClient.ts +++ b/src/lib/PoWebClient.ts @@ -257,11 +257,7 @@ export class PoWebClient { } finally { stateManager.throwConnectionErrorIfAny(); - if (stateManager.hasServerClosedConnection) { - ws.close(WebSocketCode.NORMAL); - } else { - ws.close(stateManager.clientCloseFrame.code, stateManager.clientCloseFrame.reason); - } + ws.close(stateManager.clientCloseFrame.code, stateManager.clientCloseFrame.reason); stateManager.throwClientErrorIfAny(); } diff --git a/src/lib/_websocketUtils.ts b/src/lib/_websocketUtils.ts index e0dc8d20..db2e7334 100644 --- a/src/lib/_websocketUtils.ts +++ b/src/lib/_websocketUtils.ts @@ -34,10 +34,6 @@ export class WebSocketStateManager { // tslint:disable-next-line:readonly-keyword private connectionError: Error | undefined; - get hasServerClosedConnection(): boolean { - return !!this.serverCloseFrame; - } - get clientCloseFrame(): CloseFrame { return this._clientCloseFrame; }