Skip to content

Commit d2be7ed

Browse files
committed
pr changes
1 parent da91608 commit d2be7ed

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

documents/MQTT5_Userguide.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
- [Subscribe](#subscribe)
2525
- [Unsubscribe](#unsubscribe)
2626
- [Publish](#publish)
27-
* [MQTT5 Best Practices](#mqtt5-best-practices)
2827
* [Advanced Operations and Settings](#advanced-operations-and-settings)
2928
+ [Manual Publish Acknowledgement](#manual-publish-acknowledgement)
29+
* [MQTT5 Best Practices](#mqtt5-best-practices)
3030

3131
# Introduction
3232

@@ -768,7 +768,7 @@ By default, the MQTT5 client automatically sends a PUBACK for every QoS 1 PUBLIS
768768
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()`.
769769
770770
**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`.
772772
* `acquirePublishAcknowledgement()` may only be called once per received PUBLISH. Subsequent calls return `nullptr`.
773773
* This is only relevant for QoS 1 messages. For QoS 0 messages, `acquirePublishAcknowledgement()` returns `nullptr`.
774774
* 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
817817
818818
```
819819

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+
820828

821829
# MQTT5 Best Practices
822830

0 commit comments

Comments
 (0)