Close before terminate + update presence on message receive

This commit is contained in:
Adhiraj Singh
2020-10-11 23:08:48 +05:30
parent 357069ec2c
commit 210b467b68
6 changed files with 54 additions and 15 deletions

View File

@@ -52,7 +52,6 @@ export class WAConnection extends Base {
this.emit ('open', result)
this.releasePendingRequests ()
this.startKeepAliveRequest()
this.log ('opened connection to WhatsApp Web', MessageLogLevel.info)
@@ -114,6 +113,9 @@ export class WAConnection extends Base {
}
try {
await this.authenticate (startDebouncedTimeout, stopDebouncedTimeout, reconnectID)
this.startKeepAliveRequest()
this.conn
.removeAllListeners ('error')
.removeAllListeners ('close')
@@ -269,7 +271,6 @@ export class WAConnection extends Base {
resolveTask = resolve
cancelChats = () => reject (CancelledError())
})
console.log ('resolved task')
const oldChats = this.chats
const updatedChats: { [k: string]: Partial<WAChat> } = {}