|
AWS IoT Device SDK C:
MQTT
MQTT 3.1.1 client library
|
| Return to main page ↑ |
Subscribes to the given array of topic filters and optionally receive an asynchronous notification when the subscribe completes.
This function sends an MQTT SUBSCRIBE packet to the server. A SUBSCRIBE packet notifies the server to send any matching PUBLISH messages to this client. A single SUBSCRIBE packet may carry more than one topic filter, hence the parameters to this function include an array of subscriptions.
An MQTT subscription has two pieces:
The helper function IotMqtt_IsSubscribed can be used to check if a callback function is registered for a particular topic filter.
To modify an already-registered subscription callback, call this function with a new pSubscriptionList. Any topic filters in pSubscriptionList that already have a registered callback will be replaced with the new values in pSubscriptionList.
| [in] | mqttConnection | The MQTT connection to use for the subscription. |
| [in] | pSubscriptionList | Pointer to the first element in the array of subscriptions. |
| [in] | subscriptionCount | The number of elements in pSubscriptionList. |
| [in] | flags | Flags which modify the behavior of this function. See MQTT Function Flags. |
| [in] | pCallbackInfo | Asynchronous notification of this function's completion (NULL to disable). |
| [out] | pSubscribeOperation | Set to a handle by which this operation may be referenced after this function returns. This reference is invalidated once the subscription operation completes. |
Example