Closed amruth-peel closed 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.
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.
This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.
@karthiksaligrama @kvasukib @gkwicker @rohandubal
To help us solve your problem better, please answer the following list of questions.
What service are you using? AWS IOT
In what version of SDK are you facing the problem?
Is the issue limited to Simulators / Actual Devices? all
Can your problem be resolved if you bump to a higher version of SDK? No
Is this problem related to specific iOS version? No
How are you consuming the SDK? CocoaPods / Carthage / Prebuilt frameworks? CocoaPods
Can you give us steps to reproduce with a minimal, complete, and verifiable example? Please include any specific network conditions that might be required to reproduce the problem.
===================
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.