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,
|
timeoutMs: 60*1000,
|
||||||
waitForChats: true,
|
waitForChats: true,
|
||||||
maxRetries: 5,
|
maxRetries: 5,
|
||||||
connectCooldownMs: 2250
|
connectCooldownMs: 2250,
|
||||||
|
phoneResponseTime: 7500
|
||||||
}
|
}
|
||||||
/** When to auto-reconnect */
|
/** When to auto-reconnect */
|
||||||
autoReconnect = ReconnectMode.onConnectionLost
|
autoReconnect = ReconnectMode.onConnectionLost
|
||||||
|
|||||||
@@ -275,6 +275,10 @@ export class WAConnection extends Base {
|
|||||||
if (this.logLevel === MessageLogLevel.all) {
|
if (this.logLevel === MessageLogLevel.all) {
|
||||||
this.log(messageTag + ', ' + JSON.stringify(json), 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
|
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,
|
// poll phone connection as well,
|
||||||
// 5000 ms for timeout
|
// 5000 ms for timeout
|
||||||
this.checkPhoneConnection (5000)
|
this.checkPhoneConnection (this.connectOptions.phoneResponseTime || 7500)
|
||||||
.then (connected => {
|
.then (connected => {
|
||||||
this.phoneConnected !== connected && this.emit ('connection-phone-change', {connected})
|
this.phoneConnected !== connected && this.emit ('connection-phone-change', {connected})
|
||||||
this.phoneConnected = connected
|
this.phoneConnected = connected
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ export type WAConnectOptions = {
|
|||||||
maxRetries?: number
|
maxRetries?: number
|
||||||
/** should the chats be waited for */
|
/** should the chats be waited for */
|
||||||
waitForChats?: boolean
|
waitForChats?: boolean
|
||||||
|
/** max time for the phone to respond to a connectivity test */
|
||||||
|
phoneResponseTime?: number
|
||||||
|
|
||||||
connectCooldownMs?: number
|
connectCooldownMs?: number
|
||||||
/** agent which can be used for proxying connections */
|
/** agent which can be used for proxying connections */
|
||||||
|
|||||||
Reference in New Issue
Block a user