mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
updates
This commit is contained in:
@@ -47,7 +47,8 @@ export class WAConnection extends EventEmitter {
|
||||
timeoutMs: 60*1000,
|
||||
waitForChats: true,
|
||||
maxRetries: 5,
|
||||
connectCooldownMs: 2250
|
||||
connectCooldownMs: 2250,
|
||||
phoneResponseTime: 7500
|
||||
}
|
||||
/** When to auto-reconnect */
|
||||
autoReconnect = ReconnectMode.onConnectionLost
|
||||
|
||||
@@ -275,6 +275,10 @@ export class WAConnection extends Base {
|
||||
if (this.logLevel === MessageLogLevel.all) {
|
||||
this.log(messageTag + ', ' + JSON.stringify(json), MessageLogLevel.all)
|
||||
}
|
||||
if (!this.phoneConnected) {
|
||||
this.phoneConnected = true
|
||||
this.emit ('connection-phone-change', { connected: true })
|
||||
}
|
||||
/*
|
||||
Check if this is a response to a message we sent
|
||||
*/
|
||||
@@ -340,7 +344,7 @@ export class WAConnection extends Base {
|
||||
|
||||
// poll phone connection as well,
|
||||
// 5000 ms for timeout
|
||||
this.checkPhoneConnection (5000)
|
||||
this.checkPhoneConnection (this.connectOptions.phoneResponseTime || 7500)
|
||||
.then (connected => {
|
||||
this.phoneConnected !== connected && this.emit ('connection-phone-change', {connected})
|
||||
this.phoneConnected = connected
|
||||
|
||||
@@ -72,6 +72,8 @@ export type WAConnectOptions = {
|
||||
maxRetries?: number
|
||||
/** should the chats be waited for */
|
||||
waitForChats?: boolean
|
||||
/** max time for the phone to respond to a connectivity test */
|
||||
phoneResponseTime?: number
|
||||
|
||||
connectCooldownMs?: number
|
||||
/** agent which can be used for proxying connections */
|
||||
|
||||
Reference in New Issue
Block a user