Share this page

# mqtt_create

Creates an MQTT client and returns its connection handle.

## C Language

MQTT mqtt_create();

MQTT Vuser Functions

## Arguments

None

## General Information

mqtt_create creates one MQTT client and returns that client's handle. The client is discarded on Vuser termination.

Two clients per Vuser can be created.

## Return Values

The MQTT client handle.

## Parameterization

Standard parameterization is not available for this function.

## Example

This example shows how to create a connection handle, connect, and disconnect.

/* Declare MQTT client handle variable */

`MQTT client;`

/* Create client object and assign its handle to a variable */

`client = mqtt_create();`

/* Connect MQTT client to a broker at test.broker.com using TCP port number 1883 and insecure channel */

`mqtt_connect(client, "tcp://test.broker.com:1883")`;

/*

..... Script logic .....

*/

/* Disconnect MQTT client from the broker */

`mqtt_disconnect(client);`

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