Skip to content

Commit 72c008d

Browse files
authored
docs: update documentation for publish and subscribe (#1936)
The return types for `subscribeAsync` und `publishAsync` where not up to date. Closes #1788
1 parent 1ca3f9e commit 72c008d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -613,15 +613,16 @@ Publish a message to a topic
613613
- `subscriptionIdentifier`: representing the identifier of the subscription `number`,
614614
- `contentType`: String describing the content of the Application Message `string`
615615
- `cbStorePut` - `function ()`, fired when message is put into `outgoingStore` if QoS is `1` or `2`.
616-
- `callback` - `function (err)`, fired when the QoS handling completes,
616+
- `callback` - `function (err, packet)`, fired when the QoS handling completes,
617617
or at the next tick if QoS 0. An error occurs if client is disconnecting.
618618

619619
<a name="publish-async"></a>
620620

621621
### mqtt.Client#publishAsync(topic, message, [options])
622622

623-
Async [`publish`](#publish). Returns a `Promise<void>`.
623+
Async [`publish`](#publish). Returns a `Promise<Packet | undefined>`.
624624

625+
A packet is anything that has a `messageId` property.
625626
---
626627

627628
<a name="subscribe"></a>
@@ -653,7 +654,7 @@ Subscribe to a topic or topics
653654
654655
### mqtt.Client#subscribeAsync(topic/topic array/topic object, [options])
655656
656-
Async [`subscribe`](#subscribe). Returns a `Promise<granted[]>`.
657+
Async [`subscribe`](#subscribe). Returns a `Promise<ISubscriptionGrant[]>`.
657658
658659
---
659660

0 commit comments

Comments
 (0)