Baileys
Baileys copied to clipboard
Fixing Timed Out error on connection initialization
Fixes the timed out error when initializing the connection, this error occurs because when connecting, a query is sent to the socket, which in turn breaks the application when it fails.
The solution suggested in the code is to close the connection in case of an error instead of popping the error.
Thanks for your contribution.
The next step is to wait for review and approval to merge it to main repository
The community can help reacting with a thumb up (:thumbsup:) for approval and rocket (:rocket:) for who has tested it.
To test this PR you can run the following command below:
# NPM
npm install @whiskeysockets/baileys@laxeder/Baileys#master
# YARN v2
yarn add @whiskeysockets/baileys@laxeder/Baileys#master
Good work, though its better to know what is causing this error and preventing that instead of try-catching it. Though in general we should have some hook that catches any errors and closes the connection instead of crashing your app, that is out of the scope of this issue.
True, this error occurred to me here when finishing the connection sock.end(...)
and right after triggering the connection closed event, reconnecting by recreating the socket makeWASocket(...)
I believe that this first query is precisely to validate whether the connection was successful, I believe that WhatsApp may not have released the connection correctly when disconnecting or due to the very short interval between disconnection and connection causing the loss of the response to this validation query.
Another way to solve it could be to try to request this query more than once in case of failure... however, in any case, if it were not answered it would continue to crash the application, that's terrible.
message.upsert still doesn't work with that push sadly
message.upsert still doesn't work with that push sadly
This pull request does not solve the problem in messages.upsert
, I just referenced the error presented in some related commits
news guys?
Was this merged? Or do I need to npm install this specific branch?
Was this merged? Or do I need to npm install this specific branch?
?