mqtt 5.7.0 → 5.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mqtt",
3
3
  "description": "A library for the MQTT protocol",
4
- "version": "5.7.0",
4
+ "version": "5.7.2",
5
5
  "contributors": [
6
6
  "Adam Rudd <adamvrr@gmail.com>",
7
7
  "Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)",
@@ -124,7 +124,7 @@
124
124
  "rfdc": "^1.3.0",
125
125
  "split2": "^4.2.0",
126
126
  "worker-timers": "^7.1.4",
127
- "ws": "^8.14.2"
127
+ "ws": "^8.17.1"
128
128
  },
129
129
  "devDependencies": {
130
130
  "@esm-bundle/chai": "^4.3.4-fix.0",
@@ -54,7 +54,7 @@ const handleAck: PacketHandler = (client, packet) => {
54
54
  const type = packet.cmd
55
55
  let response = null
56
56
  const cb = client.outgoing[messageId] ? client.outgoing[messageId].cb : null
57
- let err
57
+ let err = null
58
58
 
59
59
  // Checking `!cb` happens to work, but it's not technically "correct".
60
60
  //
@@ -117,7 +117,11 @@ const handleAck: PacketHandler = (client, packet) => {
117
117
  client.messageIdProvider.deallocate(messageId)
118
118
  const granted = packet.granted as number[]
119
119
  for (let grantedI = 0; grantedI < granted.length; grantedI++) {
120
- if ((granted[grantedI] & 0x80) !== 0) {
120
+ const subackRC = granted[grantedI]
121
+ if ((subackRC & 0x80) !== 0) {
122
+ err = new Error(`Subscribe error: ${ReasonCodes[subackRC]}`)
123
+ err.code = subackRC
124
+
121
125
  // suback with Failure status
122
126
  const topics = client.messageIdToTopic[messageId]
123
127
  if (topics) {
@@ -129,7 +133,7 @@ const handleAck: PacketHandler = (client, packet) => {
129
133
  }
130
134
  delete client.messageIdToTopic[messageId]
131
135
  client['_invokeStoreProcessingQueue']()
132
- cb(null, packet)
136
+ cb(err, packet)
133
137
  break
134
138
  }
135
139
  case 'unsuback': {