MQTT API Reference
MQTT 3.1.1 client library
IotMqtt_PublishSync

Publish a message to the given topic name with a timeout.

const IotMqttPublishInfo_t * pPublishInfo,
uint32_t flags,
uint32_t timeoutMs );

This function transmits an MQTT PUBLISH packet to the server, then waits for a server response to the packet. Internally, this function is a call to IotMqtt_PublishAsync followed by IotMqtt_Wait. See IotMqtt_PublishAsync for more information about the MQTT PUBLISH operation.

Attention
QoS 2 messages are currently unsupported. Only 0 or 1 are valid for message QoS.
Parameters
[in]mqttConnectionThe MQTT connection to use for the publish.
[in]pPublishInfoMQTT publish parameters.
[in]flagsFlags which modify the behavior of this function. See MQTT Function Flags. Currently, flags are ignored by this function; this parameter is for future-compatibility.
[in]timeoutMsIf the MQTT server does not acknowledge a QoS 1 PUBLISH within this timeout, this function returns IOT_MQTT_TIMEOUT. This parameter is ignored for QoS 0 PUBLISH messages.
Returns
One of the following:
IotMqttError_t
IotMqttError_t
Return codes of MQTT functions.
Definition: iot_mqtt_types.h:103
IotMqttConnection_t
struct _mqttConnection * IotMqttConnection_t
Opaque handle of an MQTT connection.
Definition: iot_mqtt_types.h:66
IotMqtt_PublishSync
IotMqttError_t IotMqtt_PublishSync(IotMqttConnection_t mqttConnection, const IotMqttPublishInfo_t *pPublishInfo, uint32_t flags, uint32_t timeoutMs)
Publish a message to the given topic name with a timeout.
Definition: iot_mqtt_api.c:1866
IotMqttPublishInfo_t
Information on a PUBLISH message.
Definition: iot_mqtt_types.h:397