New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auto-reconnect not working for initial connection attempt. #77
Comments
@databus23 initial connection can be inside a loop so something like
this will try to connect every 5 seconds, once connection is established it will break out the loop |
This is working as designed, in that there was no intention to do automatic reattempts to connect on initial connection. If you have specified multiple servers to connect to the client will attempt to connect to each in turn if it fails to connect to the previous one, and if we are in automatic version mode we will attempt to connect at version 3 if version 4 was unsuccessful. |
I don't see how this is a good reason to close this. |
I'd like to add that I got caught out majorly on this. I'd assert that most times, there's just one URI to connect - particularly given when service discovery is in place. The distinction between an initial connection and retrying a connection is, for me at least, unintuitive and diminishes the usefulness of auto-reconnect. |
Unfortunately the Paho library [doesn't support the management of initial connects failing by design](eclipse/paho.mqtt.golang#77). This PR warns the reader.
This is a follow up on #52, maybe, sort of, I don't know...
I might be missing something here, it seems to me that the re-connect logic is not kicking in for the initial connection to the broker.
Only when the initial connection is successful, the client goes into a reconnect loop whenever the connection is lost.
Is this by design? If so this would mean users of the client would need to implement a second reconnect logic outside of the client to cover all cases. Otherwise they are stuck with disconnected client when the broker happened to be unreachable when the client starts up.
The text was updated successfully, but these errors were encountered: