mqtt_set_client_id
Sets the MQTT Client ID for connection.
C Language
int mqtt_set_client_id( MQTT handle, const char* id);
Example | MQTT Vuser Functions |
Arguments
Name | Comments |
---|---|
handle | The MQTT client handle returned by mqtt_create. |
id | The client ID string must be unique in the network. Do not pass an empty string. |
General
mqtt_set_client_id sets the MQTT Client ID. If this function is not passed, the ID is generated automatically prior to connection. Call this function before mqtt_connect.
If invalid arguments are passed, the Vuser aborts, even if Continue on error is set.
Return Values
MQTT_SUCCESS or MQTT_FAIL
Parameterization
Standard parameterization is available for this function.
Example
MQTT client = mqtt_create();
mqtt_set_client_id(client, "id-1235"); // set the Client ID for connection
mqtt_connect(client, "tcp://test.broker.com:1883");