MQTT API Reference
MQTT 3.1.1 client library
IotMqtt_UnsubscribeAsync

Unsubscribes from the given array of topic filters and optionally receive an asynchronous notification when the unsubscribe completes.

const IotMqttSubscription_t * pSubscriptionList,
size_t subscriptionCount,
uint32_t flags,
const IotMqttCallbackInfo_t * pCallbackInfo,
IotMqttOperation_t * const pUnsubscribeOperation );

This function sends an MQTT UNSUBSCRIBE packet to the server. An UNSUBSCRIBE packet removes registered topic filters from the server. After unsubscribing, the server will no longer send messages on these topic filters to the client.

Corresponding subscription callback functions are also removed from the MQTT connection. These subscription callback functions will be removed even if the MQTT UNSUBSCRIBE packet fails to send.

Parameters
[in]mqttConnectionThe MQTT connection used for the subscription.
[in]pSubscriptionListPointer to the first element in the array of subscriptions.
[in]subscriptionCountThe number of elements in pSubscriptionList.
[in]flagsFlags which modify the behavior of this function. See MQTT Function Flags.
[in]pCallbackInfoAsynchronous notification of this function's completion (NULL to disable).
[out]pUnsubscribeOperationSet to a handle by which this operation may be referenced after this function returns. This reference is invalidated once the unsubscribe operation completes.
Returns
This function will return IOT_MQTT_STATUS_PENDING upon success.
Upon completion of the unsubscribe (either through an IotMqttCallbackInfo_t or IotMqtt_Wait), the status will be one of:
If this function fails before queuing an unsubscribe operation, it will return one of:
See also
IotMqtt_UnsubscribeSync for a blocking variant of this function.
IotMqtt_SubscribeAsync for the function that adds subscriptions.
IotMqttError_t
IotMqttError_t
Return codes of MQTT functions.
Definition: iot_mqtt_types.h:103
IotMqttCallbackInfo_t
MQTT callback function and context.
Definition: iot_mqtt_types.h:507
IotMqttOperation_t
struct _mqttOperation * IotMqttOperation_t
Opaque handle that references an in-progress MQTT operation.
Definition: iot_mqtt_types.h:88
IotMqtt_UnsubscribeAsync
IotMqttError_t IotMqtt_UnsubscribeAsync(IotMqttConnection_t mqttConnection, const IotMqttSubscription_t *pSubscriptionList, size_t subscriptionCount, uint32_t flags, const IotMqttCallbackInfo_t *pCallbackInfo, IotMqttOperation_t *const pUnsubscribeOperation)
Unsubscribes from the given array of topic filters and optionally receive an asynchronous notificatio...
Definition: iot_mqtt_api.c:1541
IotMqttConnection_t
struct _mqttConnection * IotMqttConnection_t
Opaque handle of an MQTT connection.
Definition: iot_mqtt_types.h:66
IotMqttSubscription_t
MQTT subscription.
Definition: iot_mqtt_types.h:541