int mqtt_subscribe( MQTT handle, const char* topic);
|Example||MQTT Vuser Functions|
|handle||The MQTT client handle returned by mqtt_create.|
The destination topic as a null-terminated string. The topic can contain wildcards.
mqtt_subscribe subscribes the client to a topic or a set of topics that match the wildcard. The broker sends messages published on these topics automatically.
If the connection is lost during mqtt_subscribe, the client tries to subscribe again after reconnection.
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 to subscribed topics */
/* Unsubscribe from the topic "sensors/temperature/surface/3" */
/* Now the client will receive messages from all subscriptions except for "sensors/temperature/surface/3" */