aws-amplify / aws-sdk-ios

AWS SDK for iOS. For more information, see our web site:
https://aws-amplify.github.io/docs
Other
1.68k stars 885 forks source link

AWS IOT sdk for iOS : No way to find if publish was successful #851

Closed amruth-peel closed 6 years ago

amruth-peel commented 6 years ago

@karthiksaligrama @kvasukib @gkwicker @rohandubal

To help us solve your problem better, please answer the following list of questions.

===================

We have implemented AWS IOT in our Android and iOS app for delivering message payloads over MQTT. We would like to know if our message publishing is successful or failed, and perform appropriate next step. We are having issues with APIs provided in iOS SDK.

AWS IOT SDK in iOS does not provide the delivery status of MQTT publishing as part of publish API below.

API : - (BOOL)publishString:(NSString )string onTopic:(NSString )topic QoS:(AWSIoTMQTTQoS)qos

https://github.com/aws/aws-sdk-ios/blob/master/AWSIoT/AWSIoTDataManager.m

Where as, AWS IOT SDK in Android provides an MQTT publish API that can tell if it succeeded or not through AWSIotMqttMessageDeliveryCallback.

API : public void publishString(String str, String topic, AWSIotMqttQos qos, AWSIotMqttMessageDeliveryCallback cb, Object userData)

https://github.com/aws/aws-sdk-android/blob/master/aws-android-sdk-iot/src/main/java/com/amazonaws/mobileconnectors/iot/AWSIotMqttManager.java

How do we consistently get correct delivery status of MQTT publishing in iOS? Is there an alternative to AWSIotMqttMessageDeliveryCallback that we are supposed to use in iOS?

===================

If you need help with understanding how to implement something in particular then we suggest that you first look into our developer guide. You can also simplify your process of creating an application by using Mobile Hub.

mutablealligator commented 6 years ago

Thank you @amruth-peel for reporting to us. Sorry for the inconvenience caused. We currently do not have a callback for the publishString method. However we suggest two partial workarounds:

1) You can change the QoS to AWSIoTMQTTQoSMessageDeliveryAttemptedAtLeastOnce which will retry the delivery of messages. However this has a downside of delivering more than once. 2) Your app can subscribe to the same topic to get notified when the publish is successful. With both of these workarounds in place, you should get notified of a successful publish. However for a failed publish I currently do not have a workaround to know that.

We will take it as a feature request in the IoT SDK to add this. Thank you for your patience.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 6 years ago

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.