From de395b0a367b18b75eb2c177acf269825a75e316 Mon Sep 17 00:00:00 2001 From: Andrey Platov Date: Wed, 27 Oct 2021 11:30:32 +0200 Subject: [PATCH] potential `ping` fix Signed-off-by: Andrey Platov --- plugins/client-resources/src/connection.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/plugins/client-resources/src/connection.ts b/plugins/client-resources/src/connection.ts index d58873d17a..b003c95918 100644 --- a/plugins/client-resources/src/connection.ts +++ b/plugins/client-resources/src/connection.ts @@ -36,6 +36,12 @@ class Connection implements Storage { private lastId = 0 constructor (private readonly url: string, private readonly handler: TxHander) { + console.log('connection created') + setInterval(() => { + console.log('ping') + // eslint-disable-next-line @typescript-eslint/no-floating-promises + this.sendRequest('ping') + }, 10000) } private openConnection (): Promise { @@ -56,14 +62,9 @@ class Connection implements Storage { this.handler(resp.result as Tx) } } - const interval = setInterval(() => { - console.log('ping') - // eslint-disable-next-line @typescript-eslint/no-floating-promises - this.sendRequest('ping') - }, 10000) websocket.onclose = () => { console.log('client websocket closed') - clearInterval(interval) + // clearInterval(interval) this.websocket = null } return new Promise((resolve, reject) => {