From a21dec0332ae7cc8153cd8c774e5d5c75be88fdd Mon Sep 17 00:00:00 2001 From: Daniel Isaksen Date: Wed, 6 Sep 2023 23:23:39 +0200 Subject: [PATCH] README: Clarify the mechanism behind `connectAsync` (#1661) * Clarifies the `connectAsync` function documentation to explain how the promise is resolved or rejected, and why the `manualConnect` option cannot work. --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cd2ab699a..7a2be0e80 100644 --- a/README.md +++ b/README.md @@ -341,7 +341,15 @@ constructor. ### connectAsync([url], options) -Async [`connect`](#connect). Returns a `Promise` that resolves to a `mqtt.Client` instance. +Asynchronous wrapper around the [`connect`](#connect) function. + +Returns a `Promise` that resolves to a `mqtt.Client` instance when the client +fires a `'connect'` or `'end'` event, or rejects with an error if the `'error'` +is fired. + +Note that the `manualConnect` option will cause the promise returned by this +function to never resolve or reject as the underlying client never fires any +events. ---