mqtt 5.10.2 → 5.10.3

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.10.2",
4
+ "version": "5.10.3",
5
5
  "contributors": [
6
6
  "Adam Rudd <adamvrr@gmail.com>",
7
7
  "Matteo Collina <matteo.collina@gmail.com> (https://github.com/mcollina)",
@@ -63,9 +63,9 @@
63
63
  "build:browser": "node esbuild.js",
64
64
  "build": "npm run build:ts && npm run build:browser",
65
65
  "prepare": "npm run build",
66
- "unit-test:node": "node_modules/.bin/nyc node -r esbuild-register test/runTests.ts",
66
+ "unit-test:node": "node -r esbuild-register --test-concurrency 4 --test-reporter=junit --test-reporter-destination=junit.xml --test-reporter=spec --test-reporter-destination=stdout --test test/node/*.ts ",
67
67
  "unit-test:browser": "wtr",
68
- "test:node": "npm run unit-test:node && codecov",
68
+ "test:node": "node_modules/.bin/nyc npm run unit-test:node",
69
69
  "test:browser": "npm run build && npm run unit-test:browser",
70
70
  "test": "npm run test:node",
71
71
  "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md",
@@ -142,7 +142,6 @@
142
142
  "aedes-cli": "^0.8.0",
143
143
  "chai": "^4.3.10",
144
144
  "chokidar": "^3.5.3",
145
- "codecov": "^3.8.2",
146
145
  "conventional-changelog-cli": "^4.1.0",
147
146
  "end-of-stream": "^1.4.4",
148
147
  "esbuild": "^0.19.5",
package/src/lib/client.ts CHANGED
@@ -162,6 +162,12 @@ export interface IClientOptions extends ISecureClientOptions {
162
162
  * 1000 milliseconds, interval between two reconnections
163
163
  */
164
164
  reconnectPeriod?: number
165
+ /**
166
+ * Set to true to enable the reconnect period to apply if the initial
167
+ * connection is denied with an error in the CONNACK packet, such as with an
168
+ * authentication error.
169
+ */
170
+ reconnectOnConnackError?: boolean
165
171
  /**
166
172
  * 30 * 1000 milliseconds, time to wait before a CONNACK is received
167
173
  */
@@ -49,6 +49,9 @@ const handleConnack: PacketHandler = (client, packet: IConnackPacket) => {
49
49
  rc,
50
50
  )
51
51
  client.emit('error', err)
52
+ if (client.options.reconnectOnConnackError) {
53
+ client['_cleanUp'](true)
54
+ }
52
55
  }
53
56
  }
54
57