tulir / whatsmeow

Go library for the WhatsApp web multidevice API
https://go.mau.fi/whatsmeow
Mozilla Public License 2.0
2.27k stars 422 forks source link

Websocket gets disconnected while waiting for infoquery error when using PairPhone() #647

Closed tijnstolwijk closed 2 months ago

tijnstolwijk commented 2 months ago

When using PairPhone() a disconnection error gets thrown.

    if !tempClient.IsConnected() {
        err := tempClient.Connect()
        if err != nil && err.Error() != "websocket is already connected" {
            return "Error connecting: " + err.Error()
        }
    }
    pairCode, err := tempClient.PairPhone(phoneNumber, true, whatsmeow.PairClientChrome, "Chrome (Linux)")
    if err != nil {
            return "Error pairing phone: " + err.Error()
    }

Then this gives the error:

Error pairing phone: websocket disconnected before info query returned response

I am sure there is no issue with my internet speed or my connectivity, although it does take a while after calling the function for it to return with an error, seeming to suggest something is timing out. I however do not know how this is possible because the connection works normally

I also modified the example project to use a pairing code, but this worked fine.

This issue randomly appeared a few days ago, making code that worked fine for a very long time suddenly break. I've also tried updating whatsmeow to the latest version, but this didn't make the code work