Add IoT connection callback to pass Session Present information to client #1558
Labels
feature-request
Request a new feature
iot
Issues related to the IoT SDK
product review
Issues awaiting product evaluation/review
Which AWS Services is the feature request for?
IoT, specifically the AWSIoTDataManager class
Is your feature request related to a problem? Please describe.
The current API for connections takes a statusCallback closure that is called when the connection status changes, but there is no way for it to convey when a connection happens to a persistent session (as described in https://docs.aws.amazon.com/iot/latest/developerguide/mqtt-persistent-sessions.html). The persistent session does work, as the subscriptions are called if connecting within the expiry period, but there is currently no way for the client to know if it worked or not.
The current callback has an enumeration that indicates the connection status only. Looking at the code in the following function:
aws-sdk-ios/AWSIoT/Internal/MQTTSDK/AWSMQTTSession.m
Line 364 in 806daa1
Describe the solution you'd like
Add an optional callback parameter to the connection functions which would be called back specifically for "connected" events, passing the session present flag into the callback
e.g. current definition:
suggested definition:
When the status specifically goes from connecting -> connected, the framework would additionally call this new callback function and pass in the session present flag from the CONNACK it receives in the connection event.
Describe alternatives you've considered
One alternative would be to add an extendedCallback version of the function that would pass this flag into the status callback, but that doesn't seem useful since the sessionPresent parameter is only valid in the connection case.
Another alternative would be to add enum values, "connectedPresentSession" and "connectedCleanSession", but that would be a breaking change because either "connected" would be removed, or its meaning would change.
Additional context
N/A
The text was updated successfully, but these errors were encountered: