Skip to content

Commit

Permalink
Packet in ack event is PUBREL in QoS 2
Browse files Browse the repository at this point in the history
Relates to moscajs#257
  • Loading branch information
gnought committed Jul 20, 2019
1 parent a066201 commit 91bcf70
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Events:
2. `client`, it will be null if the message is published using
[`publish`](#publish). It is by design that the broker heartbeat will be on publish event, in this case `client` is null
* `ack`: when a packet published to a client is delivered successfully with QoS 1 or QoS 2, arguments:
1. `packet`
1. `packet`, this will be the original PUBLISH packet in QoS 1, and PUBREL in QoS 2
2. `client`
* `ping`: when a [Client](#client) sends a ping, arguments:
1. `packet`
Expand Down
5 changes: 2 additions & 3 deletions test/client-pub-sub.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ test('emit a `ack` event on PUBACK for QoS 1', function (t) {
})

test('emit a `ack` event on PUBCOMP for QoS 2', function (t) {
t.plan(6)
t.plan(5)

var broker = aedes()
var messageId
Expand All @@ -132,8 +132,7 @@ test('emit a `ack` event on PUBCOMP for QoS 2', function (t) {
broker.once('ack', function (packet, client) {
t.equal(client.id, clientId)
t.equal(packet.messageId, messageId)
t.equal(packet.topic, 'hello')
t.equal(packet.payload.toString(), 'world')
t.equal(packet.cmd, 'pubrel')
t.pass('got the ack event')
})

Expand Down

0 comments on commit 91bcf70

Please sign in to comment.