mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Terminate connection on false pong
This commit is contained in:
@@ -211,6 +211,11 @@ export class WAConnection extends Base {
|
|||||||
if (anyTriggered) return
|
if (anyTriggered) return
|
||||||
|
|
||||||
if (this.state === 'open' && json[0] === 'Pong') {
|
if (this.state === 'open' && json[0] === 'Pong') {
|
||||||
|
if (!json[1]) {
|
||||||
|
this.closeInternal(DisconnectReason.close)
|
||||||
|
this.logger.info('Connection terminated by phone, closing...')
|
||||||
|
return
|
||||||
|
}
|
||||||
if (this.phoneConnected !== json[1]) {
|
if (this.phoneConnected !== json[1]) {
|
||||||
this.phoneConnected = json[1]
|
this.phoneConnected = json[1]
|
||||||
this.emit ('connection-phone-change', { connected: this.phoneConnected })
|
this.emit ('connection-phone-change', { connected: this.phoneConnected })
|
||||||
|
|||||||
Reference in New Issue
Block a user