mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
chore: update legacy connection close msgs
This commit is contained in:
@@ -34,11 +34,11 @@ const makeAuthSocket = (config: LegacySocketConfig) => {
|
||||
})
|
||||
// add close listener
|
||||
ws.on('ws-close', (error: Boom | Error) => {
|
||||
logger.info({ error }, 'Closed connection to WhatsApp')
|
||||
logger.info({ error }, 'closed connection to WhatsApp')
|
||||
initTimeout && clearTimeout(initTimeout)
|
||||
// if no reconnects occur
|
||||
// send close event
|
||||
updateState({
|
||||
updateState({
|
||||
connection: 'close',
|
||||
qr: undefined,
|
||||
lastDisconnect: {
|
||||
|
||||
@@ -96,7 +96,7 @@ export const makeSocket = ({
|
||||
return tag
|
||||
}
|
||||
const end = (error: Error | undefined) => {
|
||||
logger.debug({ error }, 'connection closed')
|
||||
logger.info({ error }, 'connection closed')
|
||||
|
||||
ws.removeAllListeners('close')
|
||||
ws.removeAllListeners('error')
|
||||
@@ -213,7 +213,7 @@ export const makeSocket = ({
|
||||
*/
|
||||
const waitForMessage = (tag: string, requiresPhoneConnection: boolean, timeoutMs?: number) => {
|
||||
if(ws.readyState !== ws.OPEN) {
|
||||
throw new Boom('Connection Closed', { statusCode: DisconnectReason.connectionClosed })
|
||||
throw new Boom('Connection not open', { statusCode: DisconnectReason.connectionClosed })
|
||||
}
|
||||
|
||||
let cancelToken = () => { }
|
||||
@@ -228,7 +228,7 @@ export const makeSocket = ({
|
||||
(resolve, reject) => {
|
||||
onRecv = resolve
|
||||
onErr = err => {
|
||||
reject(err || new Boom('Connection Closed', { statusCode: DisconnectReason.connectionClosed }))
|
||||
reject(err || new Boom('Intentional Close', { statusCode: DisconnectReason.connectionClosed }))
|
||||
}
|
||||
cancelToken = () => onErr(new Boom('Cancelled', { statusCode: 500 }))
|
||||
|
||||
@@ -311,7 +311,7 @@ export const makeSocket = ({
|
||||
const waitForSocketOpen = async() => {
|
||||
if(ws.readyState === ws.OPEN) return
|
||||
if(ws.readyState === ws.CLOSED || ws.readyState === ws.CLOSING) {
|
||||
throw new Boom('Connection Closed', { statusCode: DisconnectReason.connectionClosed })
|
||||
throw new Boom('Connection Already Closed', { statusCode: DisconnectReason.connectionClosed })
|
||||
}
|
||||
let onOpen: () => void
|
||||
let onClose: (err: Error) => void
|
||||
|
||||
Reference in New Issue
Block a user