mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: timeout send call
This commit is contained in:
@@ -38,6 +38,7 @@ export const makeSocket = ({
|
||||
agent
|
||||
})
|
||||
ws.setMaxListeners(0)
|
||||
|
||||
const ev = makeEventBuffer(logger)
|
||||
/** ephemeral key pair used to encrypt/decrypt communication. Unique for each connection */
|
||||
const ephemeralKeyPair = Curve.generateKeyPair()
|
||||
@@ -65,7 +66,17 @@ export const makeSocket = ({
|
||||
}
|
||||
|
||||
const bytes = noise.encodeFrame(data)
|
||||
await sendPromise.call(ws, bytes) as Promise<void>
|
||||
await promiseTimeout<void>(
|
||||
connectTimeoutMs,
|
||||
async(resolve, reject) => {
|
||||
try {
|
||||
await sendPromise.call(ws, bytes)
|
||||
resolve()
|
||||
} catch(error) {
|
||||
reject(error)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/** send a binary node */
|
||||
|
||||
Reference in New Issue
Block a user