Skip to content

Commit

Permalink
README: Clarify the mechanism behind connectAsync (#1661)
Browse files Browse the repository at this point in the history
* Clarifies the `connectAsync` function documentation to explain how the promise is resolved or rejected, and why the `manualConnect` option cannot work.
  • Loading branch information
dunielpls committed Sep 6, 2023
1 parent 42818de commit a21dec0
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

---

Expand Down

0 comments on commit a21dec0

Please sign in to comment.