Bug fix for sendLoginReq

This commit is contained in:
Adhiraj Singh
2020-12-02 14:21:06 +05:30
parent 84edfe1ca0
commit d4b453f0e5
2 changed files with 6 additions and 1 deletions

View File

@@ -48,6 +48,10 @@ export class WAConnection extends Base {
else json.push ('takeover')
// send login every 10s
const sendLoginReq = () => {
if (this.conn.readyState !== this.conn.OPEN) {
this.logger.warn('Received login timeout req when WS not open, ignoring...')
return
}
this.logger.debug('sending login request')
this.sendJSON(json, tag)
this.initTimeout = setTimeout(sendLoginReq, 10_000)