|
24 | 24 | - [Subscribe](#subscribe) |
25 | 25 | - [Unsubscribe](#unsubscribe) |
26 | 26 | - [Publish](#publish) |
27 | | -* [MQTT5 Best Practices](#mqtt5-best-practices) |
28 | 27 | * [Advanced Operations and Settings](#advanced-operations-and-settings) |
29 | 28 | + [Manual Publish Acknowledgement](#manual-publish-acknowledgement) |
| 29 | +* [MQTT5 Best Practices](#mqtt5-best-practices) |
30 | 30 |
|
31 | 31 | # Introduction |
32 | 32 |
|
@@ -768,7 +768,7 @@ By default, the MQTT5 client automatically sends a PUBACK for every QoS 1 PUBLIS |
768 | 768 | To take manual control of the PUBACK, call `eventData.acquirePublishAcknowledgement()` **within** the `OnPublishReceivedHandler` callback. This returns a `ScopedResource<PublishAcknowledgementHandle>` that you can store and use later to send the PUBACK by calling `client->InvokePublishAcknowledgement()`. |
769 | 769 |
|
770 | 770 | **Important constraints:** |
771 | | -* `acquirePublishAcknowledgement()` must be called within the `OnPublishReceivedHandler` callback. Calling it after the callback returns will return `nullptr`. |
| 771 | +* `acquirePublishAcknowledgement()` must be called within the `OnPublishReceivedHandler` callback. Calling it after the callback returns or from a different thread will return `nullptr`. |
772 | 772 | * `acquirePublishAcknowledgement()` may only be called once per received PUBLISH. Subsequent calls return `nullptr`. |
773 | 773 | * This is only relevant for QoS 1 messages. For QoS 0 messages, `acquirePublishAcknowledgement()` returns `nullptr`. |
774 | 774 | * If `acquirePublishAcknowledgement()` is not called (or returns `nullptr`), the client will automatically send the PUBACK when the callback returns. |
@@ -817,6 +817,14 @@ The following example shows how to acquire the acknowledgement handle within the |
817 | 817 |
|
818 | 818 | ``` |
819 | 819 |
|
| 820 | +**AWS IoT broker redelivery behavior** |
| 821 | + |
| 822 | +The AWS IoT broker will periodically resend unacknowledged QoS 1 PUBLISH packets. These redeliveries should be treated as duplicates even if the DUP flag in the PUBLISH packet is not set. If `acquirePublishAcknowledgement()` is not called again for a redelivered packet, the acknowledgement will be sent automatically. |
| 823 | + |
| 824 | +**Session resumption after disconnect/reconnect** |
| 825 | + |
| 826 | +Upon a disconnect and reconnect of the MQTT5 client, if a session is resumed, any previously acquired `ScopedResource<PublishAcknowledgementHandle>` is void. The broker will resend the unacknowledged PUBLISH packet, and `acquirePublishAcknowledgement()` must be called again within the callback for that resent packet. If the resent packet is not handled for manual acknowledgement, the acknowledgement will be sent automatically. |
| 827 | + |
820 | 828 |
|
821 | 829 | # MQTT5 Best Practices |
822 | 830 |
|
|
0 commit comments