From 794c9e16fc6e4b758ad995373d093213b6baeca5 Mon Sep 17 00:00:00 2001 From: Jan Vlach Date: Fri, 28 Feb 2020 22:00:24 +0100 Subject: [PATCH] feat: force state update (#77) Whatsapp web will not update state until some action, this will force update client state. First will set state to TIMEOUT, then to current state --- src/Client.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Client.js b/src/Client.js index db02e21..202e7d9 100644 --- a/src/Client.js +++ b/src/Client.js @@ -430,6 +430,15 @@ class Client extends EventEmitter { }, chatId); } + /** + * Force reset of connection state for the client + */ + async resetState(){ + await this.pupPage.evaluate(() => { + window.Store.AppState.phoneWatchdog.shiftTimer.forceRunNow(); + }); + } + } module.exports = Client;