aedes 0.51.1 → 0.51.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/lib/client.js CHANGED
@@ -313,7 +313,14 @@ Client.prototype.close = function (done) {
313
313
  }, noop)
314
314
  }
315
315
  })
316
+ } else if (will) {
317
+ // delete the persisted will even on clean disconnect https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349232
318
+ that.broker.persistence.delWill({
319
+ id: that.id,
320
+ brokerId: that.broker.id
321
+ }, noop)
316
322
  }
323
+
317
324
  that.will = null // this function might be called twice
318
325
  that._will = null
319
326
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aedes",
3
- "version": "0.51.1",
3
+ "version": "0.51.2",
4
4
  "description": "Stream-based MQTT broker",
5
5
  "main": "aedes.js",
6
6
  "types": "aedes.d.ts",
@@ -108,7 +108,7 @@
108
108
  "concat-stream": "^2.0.0",
109
109
  "duplexify": "^4.1.2",
110
110
  "license-checker": "^25.0.1",
111
- "markdownlint-cli": "^0.39.0",
111
+ "markdownlint-cli": "^0.41.0",
112
112
  "mqtt": "^5.3.5",
113
113
  "mqtt-connection": "^4.1.0",
114
114
  "pre-commit": "^1.2.2",
@@ -117,7 +117,7 @@
117
117
  "snazzy": "^9.0.0",
118
118
  "standard": "^17.1.0",
119
119
  "tap": "^16.3.10",
120
- "tsd": "^0.30.4",
120
+ "tsd": "^0.31.0",
121
121
  "typescript": "^5.3.3",
122
122
  "websocket-stream": "^5.5.2"
123
123
  },
@@ -129,7 +129,7 @@
129
129
  "fastparallel": "^2.4.1",
130
130
  "fastseries": "^2.0.0",
131
131
  "hyperid": "^3.2.0",
132
- "mqemitter": "^5.0.0",
132
+ "mqemitter": "^6.0.0",
133
133
  "mqtt-packet": "^9.0.0",
134
134
  "retimer": "^4.0.0",
135
135
  "reusify": "^1.0.4",
package/test/will.js CHANGED
@@ -420,6 +420,29 @@ test('does not deliver will when client sends a DISCONNECT', function (t) {
420
420
  })
421
421
  })
422
422
 
423
+ test('deletes from persistence on DISCONNECT', function (t) {
424
+ t.plan(2)
425
+
426
+ const opts = {
427
+ clientId: 'abcde'
428
+ }
429
+ const broker = aedes()
430
+ t.teardown(broker.close.bind(broker))
431
+
432
+ const s = noError(willConnect(setup(broker), opts, function () {
433
+ s.inStream.end({
434
+ cmd: 'disconnect'
435
+ })
436
+ }), t)
437
+
438
+ s.broker.persistence.getWill({
439
+ id: opts.clientId
440
+ }, function (err, packet) {
441
+ t.error(err, 'no error')
442
+ t.notOk(packet)
443
+ })
444
+ })
445
+
423
446
  test('does not store multiple will with same clientid', function (t) {
424
447
  t.plan(4)
425
448