AWS IoT Device SDK C:
MQTT
MQTT 3.1.1 client library
|
Return to main page ↑ |
Information on a PUBLISH message. More...
#include <iot_mqtt_types.h>
Data Fields | |
IotMqttQos_t | qos |
QoS of message. Must be 0 or 1. | |
bool | retain |
MQTT message retain flag. | |
const char * | pTopicName |
Topic name of PUBLISH. | |
uint16_t | topicNameLength |
Length of IotMqttPublishInfo_t.pTopicName. | |
const void * | pPayload |
Payload of PUBLISH. | |
size_t | payloadLength |
Length of IotMqttPublishInfo_t.pPayload. For LWT messages, this is limited to 65535. | |
uint32_t | retryMs |
If no response is received within this time, the message is retransmitted. | |
uint32_t | retryLimit |
How many times to attempt retransmission. | |
Information on a PUBLISH message.
Parameter for: IotMqtt_Connect, IotMqtt_PublishAsync
Passed to IotMqtt_PublishAsync as the message to publish and IotMqtt_Connect as the Last Will and Testament (LWT) message.
All instances of IotMqttPublishInfo_t should be initialized with IOT_MQTT_PUBLISH_INFO_INITIALIZER.
IotMqttPublishInfo_t.retryMs and IotMqttPublishInfo_t.retryLimit are only relevant to QoS 1 PUBLISH messages. They are ignored for QoS 0 PUBLISH messages and LWT messages. These members control retransmissions of QoS 1 messages under the following rules:
Retransmission follows a truncated exponential backoff strategy. The constant IOT_MQTT_RETRY_MS_CEILING controls the maximum time between retransmissions.
After IotMqttPublishInfo_t.retryLimit retransmissions are sent, the MQTT library will wait IOT_MQTT_RESPONSE_WAIT_MS before a final check for a PUBACK. If no PUBACK was received within this time, the QoS 1 PUBLISH fails with the code IOT_MQTT_RETRY_NO_RESPONSE.
Example
Consider a situation where
A PUBLISH message will be retransmitted at the following times after the initial transmission if no PUBACK is received:
After the 20th retransmission, the MQTT library will wait IOT_MQTT_RESPONSE_WAIT_MS before checking a final time for a PUBACK.