From 5a39683c02fc18628a76700dad589de1e5c05e95 Mon Sep 17 00:00:00 2001 From: Adhiraj Date: Thu, 16 Jul 2020 13:35:25 +0530 Subject: [PATCH] Disconnect fix --- src/WAConnection/Base.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/WAConnection/Base.ts b/src/WAConnection/Base.ts index 50b0a25..b09d6d3 100644 --- a/src/WAConnection/Base.ts +++ b/src/WAConnection/Base.ts @@ -65,8 +65,9 @@ export default class WAConnectionBase { this.close() if ((error === 'lost' || error === 'closed') && this.autoReconnect) { await this.reconnectLoop () + } else if (this.unexpectedDisconnectCallback) { + this.unexpectedDisconnectCallback (error) } - if (this.unexpectedDisconnectCallback) this.unexpectedDisconnectCallback (error) } /** Set the callback for unexpected disconnects including take over events, log out events etc. */ setOnUnexpectedDisconnect(callback: (error: string) => void) {