-
Notifications
You must be signed in to change notification settings - Fork 113
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
What happens when network disconnects abruptly? #18
Comments
Hi @shekharhimanshu , The relevant keep-alive code can be found here I'm not sure if I understand what you mean by publish/subscribe/unsubscribe. If you continue publishing on a disconnect, those publishes will fail until the device reconnects. After the auto-reconnect is successful, all MQTT operations will work as before. And yes, the disconnect callback will be called in such cases. You will see a delay between when the actual disconnect happens and when the callback is called/auto-reconnect process starts as the keep-alive needs to fail before it can recognize the fact that it is disconnected. The keep-alive interval can be changed in the config.json that is used by the project here. Please keep us posted if you have any more questions. |
Hello @vareddy This clears most of my doubts. Thanks! |
Hello, After looking through more code, I have one more think to confirm. The workaround here is to unsubscribe before subscribing again. The unsubscribe here will have no meaning to the AWS IoT message broker and will only clean up the SDK internal state. |
Hi @shekharhimanshu, Please let me know if you have further suggestions. Rahul |
Thank you for the confirmation.
IMHO, the SDK needs to define what spec of MQTT it is following as the base specification. AWS Iot message broker says If the SDK strictly follows For me, the workaround of It might be helpful to see how other mqtt clients like Mosquitto handle these situations (given the SDK follows the standard MQTT version 3.1.1). |
Hi @shekharhimanshu, Rahul |
Clear explanation/notes about these things inside the api reference/document is highly appreciated as well. |
Hi @shekharhimanshu, |
Hello,
Could you please explain how does the SDK behave on abrupt network disconnect?
When auto-reconnect is enabled, will the SDK be able to recover automatically as in be able to mqtt publish/subscribe/unsubscribe without connecting manually?
Will the disconnect callback be called in such abrupt network disconnect events?
Thanks
The text was updated successfully, but these errors were encountered: