From 1e3d21c5bff0cdd2fc36ac34ce87ae465077dc68 Mon Sep 17 00:00:00 2001 From: Benjamin Jordan Date: Thu, 4 Jul 2024 07:56:12 -0500 Subject: [PATCH] Only close adapter if it is open on error (#196) --- packages/nakama-js/socket.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/nakama-js/socket.ts b/packages/nakama-js/socket.ts index ad3aef3..c96894c 100644 --- a/packages/nakama-js/socket.ts +++ b/packages/nakama-js/socket.ts @@ -846,7 +846,10 @@ export class DefaultSocket implements Socket { } this.adapter.onError = (evt: Event) => { reject(evt); - this.adapter.close(); + + if (this.adapter.isOpen()) { + this.adapter.close(); + } }