MQTT ACK/Echo Handling¶
Implements publish acknowledgment and echo logic for reliable MQTT delivery.
This section manages the detection and processing of MQTT PUBACK or echo messages from the broker. It tracks acknowledgment state, extracts sequence numbers from echoed JSON payloads, and ensures that published messages are confirmed before considering them delivered. If no acknowledgment is received, data is saved for later recovery.
-
Uses topic-based filtering to only process echoes for the current publish topic
-
Handles retained messages and ignores them for acknowledgment
-
Extracts sequence numbers from JSON payloads for matching
-
Registers a callback for incoming MQTT messages to detect PUBACK/echo
-
Uses topic-based filtering to only process echoes for the current publish topic
-
Handles retained messages and ignores them for acknowledgment
-
Extracts sequence numbers from JSON payloads for matching
-
Registers a callback for incoming MQTT messages to detect PUBACK/echo
-
Re-subscribes to the publish topic after each reconnect
?> This logic is critical for QoS 1 delivery and robust offline recovery.