This function transmits 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 subscription topic filter registered with the MQTT server. The MQTT SUBSCRIBE packet sent from this client to server notifies the server to send messages matching the given topic filters to this client.
The callback function that this client will invoke when an incoming message is received. The callback function notifies applications of an incoming PUBLISH message.
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.
Attention
QoS 2 subscriptions are currently unsupported. Only 0 or 1 are valid for subscription QoS.
Parameters
[in]
mqttConnection
The MQTT connection to use for the subscription.
[in]
pSubscriptionList
Pointer to the first element in the array of subscriptions.
Asynchronous notification of this function's completion.
[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.