MQTT_PublishQoS0()

MQTT_PublishQoS0()

Description

Function publishes data to MQTT broker (server) with certain topic.
Function can only send through messages when devices holds active session to MQTT broker. Any attempt to use the function when connection to broker is not present will result in error returned.

Syntax

MQTT_PublishQoS0(topic, data[], len);

Parameters

Variable

Input

Variable

Input

topic

MQTT protocol topic name.

data[]

Any string data to be published.

len

Length of data array/string.

Returns

Return value

Return explanation

SCRIPT_OPERATION_SUCCESS

Success

SCRIPT_OPERATION_FAILED

Failed

SCRIPT_PARAM_INVALID

Passed parameters invalid.

Function call example

Example of publishing data to MQTT broker (server) with certain topic.
new array1{10} = "35 degrees"; main() { MQTT_PublishQoS0("temperature/ff/", array1, strlen(array1)); for(;;) { Delay(100); } }

Used in Examples

MQTT guide