Skip to content
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

Missing disconnect callback? #4

Closed
shekharhimanshu opened this issue Apr 6, 2017 · 7 comments
Closed

Missing disconnect callback? #4

shekharhimanshu opened this issue Apr 6, 2017 · 7 comments

Comments

@shekharhimanshu
Copy link
Contributor

Hello,

I am trying to understand how the SDK handles connection state. When auto-reconnect if set to false, SDK will not re-connect automatically after the keep-alive times out as set during connect and the mqtt client will become disconnected.

In the current SDK design, applications will not be able to receive information about this auto-disconnect since the SDK does not provide with a disconnect callback. aws-iot-device-sdk-embedded-C SDK provides us with such a callback here.

Having a disconnect callback might be useful in cases when applications want to control the re-connection to AWS IoT or for some other book-keeping or resource cleanups etc.

I also saw that ClientState caches the connection state and the mqtt clients return it when IsConnected api is called. Having a disconnect callback can help in making this connection state consistent as well.

Am I missing something here?

@chaurah
Copy link
Contributor

chaurah commented Apr 11, 2017

Hi @shekharhimanshu,
This seems like an oversight. We definitely need to have a disconnect callback and notification. I have added a task to add this in the next release. For now, the only available notification is the response code from API calls unfortunately.

ClientState does cache the connection state but it is also updated in the Disconnect API which is called for cleanup whenever a disconnect or unrecoverable network state is detected. It should always have the correct information. That being said, I have been debating linking it to network layer changes as well. Do you notice any issues with the current implementation?

Please let me know if you have further questions.

Rahul

@shekharhimanshu
Copy link
Contributor Author

Hello @chaurah,

Thats great. Will wait for the next release for the disconnect callback.

Yes, you are correct about the ClientState' connection state. Looks like I overlooked the part where the connection state was being updated. Thank you.

Linking the cached connection state to network layer changes would improve the usability but I am not sure if I have considered other design issues/goals of the SDK. So would wait for any update about this as well. Unfortunately, I have just started designing my application using this SDK and all my feedbacks are based upon the documentation present and the source code.

I will let you know if I find any issues during implementation/testing.

@chaurah
Copy link
Contributor

chaurah commented Apr 18, 2017

Hi @shekharhimanshu,
That sounds good. Please definitely let us know if you find anything I can help with. In the meantime, I will keep this issue open until we have added a disconnect callback to the Disconnect Action.

Rahul

@chaurah
Copy link
Contributor

chaurah commented Jun 7, 2017

This issue has been resolved with v1.1 of the SDK Please reopen if you further questions.

Rahul

@chaurah chaurah closed this as completed Jun 7, 2017
@shekharhimanshu
Copy link
Contributor Author

Hello,

Could you please explain when will this disconnect callback be called?
I could not find anything in the documentation.

@shekharhimanshu
Copy link
Contributor Author

Also, I do not see any reopen issue button. Missing permission?

@shekharhimanshu
Copy link
Contributor Author

I have opened a new issue instead. #17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants