Auties00 / Cobalt

Standalone unofficial fully-featured Whatsapp Web and Mobile API for Java and Kotlin
MIT License
611 stars 179 forks source link

Reconnects during registration process. #484

Closed schuettec closed 1 month ago

schuettec commented 2 months ago

Hi there, thanks for this lib! Great work!

While performing the registration process, I get multiple reconnects. Every time a reconnect occurs, a new code is generated. Is this normal or am I doing something wrong?

The code is use:

        Whatsapp whatsapp = Whatsapp.webBuilder()
            .lastConnection()
            .unregistered(phoneNumber, PairingCodeHandler.toTerminal())
            .connect()
            .join();

I see several codes on the console and the time to enter and authorize them in WhatsApp is too short.

Auties00 commented 2 months ago

Hi there, thanks for this lib! Great work!

While performing the registration process, I get multiple reconnects. Every time a reconnect occurs, a new code is generated. Is this normal or am I doing something wrong?

The code is use:

        Whatsapp whatsapp = Whatsapp.webBuilder()
            .lastConnection()
            .unregistered(phoneNumber, PairingCodeHandler.toTerminal())
            .connect()
            .join();

I see several codes on the console and the time to enter and authorize them in WhatsApp is too short.

Are you using 0.0.5? What if you add .awaitDisconnection() ?

schuettec commented 2 months ago

Hi, Sorry I forgot to mention the version. I tried with 0.0.4 and 0.0.5

Thx for the hint. I will test the scenario with .awaitDisconnection().

Alessandro Autiero @.***> schrieb am Sa., 27. Apr. 2024, 22:15:

Hi there, thanks for this lib! Great work!

While performing the registration process, I get multiple reconnects. Every time a reconnect occurs, a new code is generated. Is this normal or am I doing something wrong?

The code is use:

    Whatsapp whatsapp = Whatsapp.webBuilder()
        .lastConnection()
        .unregistered(phoneNumber, PairingCodeHandler.toTerminal())
        .connect()
        .join();

I see several codes on the console and the time to enter and authorize them in WhatsApp is too short.

Are you using 0.0.5? What if you add .awaitDisconnection() ?

— Reply to this email directly, view it on GitHub https://github.com/Auties00/Cobalt/issues/484#issuecomment-2081170264, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADNFVQSB3CFZZNPI4X5UJ2TY7QBMVAVCNFSM6AAAAABGYQAONGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBRGE3TAMRWGQ . You are receiving this because you authored the thread.Message ID: @.***>

Darker935 commented 2 months ago

Updates?

Auties00 commented 1 month ago

Hi, Sorry I forgot to mention the version. I tried with 0.0.4 and 0.0.5 Thx for the hint. I will test the scenario with .awaitDisconnection(). Alessandro Autiero @.> schrieb am Sa., 27. Apr. 2024, 22:15: Hi there, thanks for this lib! Great work! While performing the registration process, I get multiple reconnects. Every time a reconnect occurs, a new code is generated. Is this normal or am I doing something wrong? The code is use: Whatsapp whatsapp = Whatsapp.webBuilder() .lastConnection() .unregistered(phoneNumber, PairingCodeHandler.toTerminal()) .connect() .join(); I see several codes on the console and the time to enter and authorize them in WhatsApp is too short. Are you using 0.0.5? What if you add .awaitDisconnection() ? — Reply to this email directly, view it on GitHub <#484 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADNFVQSB3CFZZNPI4X5UJ2TY7QBMVAVCNFSM6AAAAABGYQAONGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBRGE3TAMRWGQ . You are receiving this because you authored the thread.Message ID: @.>

This is the solution

schuettec commented 2 days ago

Hi sorry for the delay. I tried with .awaitReconnection() but that does not change anything. The registration process is aborted by a reconnect after 20 seconds or so.

Whatsapp.webBuilder()
            .lastConnection()
            .unregistered(phoneNumber, PairingCodeHandler.toTerminal())
            .connect()
            .awaitDisconnection();

And I get this output:

<REGISTRATION_CODE>
Disconnected (reason): RECONNECTING
<REGISTRATION_CODE>