Open topic with navigation
int mqtt_unsubscribe( MQTT handle, const char* topic);
|Example||MQTT Vuser Functions|
|handle||The MQTT client handle returned by mqtt_create.|
|topic||The topic or wildcard topic to stop receiving messages on. See mqtt_subscribe.|
mqtt_unsubscribe unsubscribes the client from a topic or a set of topics on the broker.
You can call this function at any time during the run to stop the client from receiving messages on subscribed topics. We recommend that you call this function before mqtt_disconnect (not required).
If the connection is lost during an mqtt_unsubscribe operation, the client will not try to unsubscribe again after reconnecting, and a warning will be displayed in the script's output.
If invalid arguments are passed, the Vuser aborts, even if Continue on error is set.
MQTT_SUCCESS or MQTT_FAIL
Standard parameterization is available for this function.
/* Subscribe to the topics matching the wildcard "sensors/temperature/#"*/
/* Now the client will receive messages it was subscribed to */
/* Unsubscribe from the topic "sensors/temperature/surface/3" */
/* Now it will receive messages from all subscriptions but "sensors/temperature/surface/3" */