From ccf1d3d495966009e51638bbd457ef1decd5aeb8 Mon Sep 17 00:00:00 2001 From: Linus Date: Mon, 6 Dec 2021 21:39:22 +0100 Subject: [PATCH] Document token.Wait behaviour during reconnect When a connection is lost to the broker and later resumed the token returned to the user will be considered completed and a new token will be created instead. The result of this is that there is no way for a user of this library to know whether a message has been delivered in the presence of connection issues. Signed-off-by: Linus --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index bb1060b..63a7f44 100644 --- a/README.md +++ b/README.md @@ -119,6 +119,9 @@ configure a handler with `AddRoute` or set a `DefaultPublishHandler`. * Reusing a `Client` is not completely safe. After calling `Disconnect` please create a new Client (`NewClient()`) rather than attempting to reuse the existing one (note that features such as `SetAutoReconnect` mean this is rarely necessary). * Brokers offer many configuration options; some settings may lead to unexpected results. +* Publish tokens will complete if the connection is lost and re-established using the default +options.SetAutoReconnect(true) functionality (token.Error() will return nil). Attempts will be made to re-deliver the +message but there is currently no easy way know when such messages are delivered. If using Mosquitto then there are a range of fairly common issues: * `listener` - By default [Mosquitto v2+](https://mosquitto.org/documentation/migrating-to-2-0/) listens on loopback