Update init method to try login multiple times + use WA ttl for QR gen

This commit is contained in:
Adhiraj Singh
2020-11-26 17:08:18 +05:30
parent e531a71bde
commit 7dc083b6e5
8 changed files with 107 additions and 109 deletions

View File

@@ -9,6 +9,11 @@ export class WAConnection extends Base {
constructor () {
super ()
this.setMaxListeners (30)
// on disconnects
this.on ('CB:Cmd,type:disconnect', json => (
this.state === 'open' && this.unexpectedDisconnect(json[1].kind || 'unknown')
))
// chats received
this.on('CB:response,type:chat', json => {
if (json[1].duplicate || !json[2]) return