Share this page

# mqtt_set_client_id

Sets the MQTT Client ID for connection.

## C Language

int mqtt_set_client_id( MQTT handle, const char* id);

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 Information

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");

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: