Open topic with navigation
int mqtt_connect( MQTT handle, const char* url);
|Example||MQTT Vuser Functions|
|handle||The MQTT client handle returned by mqtt_create.|
Address of the broker server in the format: tcp://host:port or ssl://host:port, where host is domain name, IPv4 address or the IPv6 address in square brackets. Example of IPv6 address:
If the port is not specified, the following default ports are used:
mqtt_connect connects the client to the broker.
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.
This example shows how to create a connection handle, connect, and disconnect.
/* Declare MQTT client handle variable */
/* 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 */
..... Script logic .....
/* Disconnect MQTT client from the broker */