Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] Connect logic when failed initial connect

Hello again,
Just wondering if someone could shed some light on this. If I need to clarify something please let me know and I will try my best to rephrase it.

Attempt to summarise the question: 

Will the mosquitto lib network loop and reconnection handled by the loop stop If the disconnected callback is called before an initial connection to the broker could be established? 

Best regards,
Erik 


From: Erik Andersson
Sent: Tuesday, March 28, 2023 1:42 PM
To: mosquitto-dev@xxxxxxxxxxx <mosquitto-dev@xxxxxxxxxxx>
Subject: Connect logic when failed initial connect
 
Hello, I have a question regarding how the connect logic is handled in the network loop when using mosquitto_loop_start and mosquitto_connect_async with the mosquittolib. After receiving a CONNACK and a initial connection have been made with the broker the reconnection is handled as I would expect. That is, if the broker goes offline and we don't receive a PINGRESP in the set keep alive interval disconnect is called and if the broker then comes back online the libraries network loop handles the reconnection with sending a new CONNECT. However, if the client never made this initial connection (no CONNACK after sending the first CONNECT) the library will not try to connect again and a new call to mosquitto_connect_async as well as mosquitto_loop_start is required since it seams that the network thread is also stopped? Furthermore, the reponse code for both mosquitto_connect_async and mosquitto_loop_start is successful. I might have misinterpereted the documentation but I thought only one call to mosquitto_connect_async would need to be done if the call was successful.

Best regards


Back to the top