AWS IoT Device SDK C:
MQTT
MQTT 3.1.1 client library
|
Return to main page ↑ |
Check if an MQTT connection has a subscription for a topic filter.
This function checks whether an MQTT connection mqttConnection
has a subscription callback registered for a topic filter pTopicFilter
. If a subscription callback is found, its details are copied into the output parameter pCurrentSubscription
. This subscription callback will be invoked for incoming PUBLISH messages on pTopicFilter
.
The check for a matching subscription is only performed client-side; therefore, this function should not be relied upon for perfect accuracy. For example, this function may return an incorrect result if the MQTT server crashes and drops subscriptions without informing the client.
Note that an MQTT connection's subscriptions might change between the time this function checks the subscription list and its caller tests the return value. This function certainly should not be used concurrently with any pending SUBSCRIBE or UNSUBSCRIBE operations.
One suitable use of this function is to check which subscriptions were rejected if IotMqtt_SubscribeAsync returns IOT_MQTT_SERVER_REFUSED; that return code only means that at least one subscription was rejected.
[in] | mqttConnection | The MQTT connection to check. |
[in] | pTopicFilter | The topic filter to check. |
[in] | topicFilterLength | Length of pTopicFilter . |
[out] | pCurrentSubscription | If a subscription is found, its details are copied here. This output parameter is only valid if this function returns true (NULL to disable). |
true
if a subscription was found; false
otherwise.pCurrentSubscription->qos
will always be set to IOT_MQTT_QOS_0.