Rhymen / go-whatsapp

WhatsApp Web API
MIT License
2.05k stars 490 forks source link

Error restore session connection timed out #556

Closed danielspk closed 3 years ago

danielspk commented 3 years ago

Hello.

I have a goroutine that tries to reconnect sessions when a ping fails (every minute). Sometimes I get strange behavior as for several consecutive retries I get the error message "restore session connection timed out" but then on subsequent retries the connection can be successfully reestablished. What could be causing those timeouts?

danielspk commented 3 years ago

I am willing to make a pull request if someone can guide where the problem may be.

I can manage the ping issue outside the project, but it is essential that any disconnection error can be managed by the error handler and this does not happen. There are soft disconnects that are not caught.

Thanks.

danielspk commented 3 years ago

Apparently my problem has to do with the device going into "sleep" mode. I see that this issue was dealt with many times in closed issues. What recommendation do you give me when I receive the message "asleep"?

Thanks.

beshoo commented 3 years ago

Do I reconnect the session? NO Is there any other way to get back online? User has to open WhatsApp on his device Should I wait for the device to be online again without taking any action YES (I think that is what WhatsApp Web does when it shows the yellow warning message - it simply informs it without taking any action) TRUE

danielspk commented 3 years ago

Thanks for your help @beshoo