Comparing version 5.10.2 to 5.10.3
@@ -49,2 +49,3 @@ /// <reference types="node" /> | ||
reconnectPeriod?: number; | ||
reconnectOnConnackError?: boolean; | ||
connectTimeout?: number; | ||
@@ -51,0 +52,0 @@ incomingStore?: IStore; |
@@ -44,2 +44,5 @@ "use strict"; | ||
client.emit('error', err); | ||
if (client.options.reconnectOnConnackError) { | ||
client['_cleanUp'](true); | ||
} | ||
} | ||
@@ -46,0 +49,0 @@ }; |
{ | ||
"name": "mqtt", | ||
"description": "A library for the MQTT protocol", | ||
"version": "5.10.2", | ||
"version": "5.10.3", | ||
"contributors": [ | ||
@@ -66,5 +66,5 @@ "Adam Rudd <adamvrr@gmail.com>", | ||
"prepare": "npm run build", | ||
"unit-test:node": "node_modules/.bin/nyc node -r esbuild-register test/runTests.ts", | ||
"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 ", | ||
"unit-test:browser": "wtr", | ||
"test:node": "npm run unit-test:node && codecov", | ||
"test:node": "node_modules/.bin/nyc npm run unit-test:node", | ||
"test:browser": "npm run build && npm run unit-test:browser", | ||
@@ -146,3 +146,2 @@ "test": "npm run test:node", | ||
"chokidar": "^3.5.3", | ||
"codecov": "^3.8.2", | ||
"conventional-changelog-cli": "^4.1.0", | ||
@@ -149,0 +148,0 @@ "end-of-stream": "^1.4.4", |
@@ -278,2 +278,9 @@ # ![mqtt.js](https://raw.githubusercontent.com/mqttjs/MQTT.js/137ee0e3940c1f01049a30248c70f24dc6e6f829/MQTT.js.png) | ||
Note that this will only enable reconnects after either a connection timeout, or | ||
after a successful connection. It will _not_ (by default) enable retrying | ||
connections that are actively denied with a CONNACK error by the server. | ||
To also enable automatic reconnects for CONNACK errors, set | ||
`reconnectOnConnackError: true`. | ||
<a name="topicalias"></a> | ||
@@ -419,2 +426,4 @@ | ||
reconnections. Disable auto reconnect by setting to `0`. | ||
- `reconnectOnConnackError`: `false`, whether to also reconnect if a CONNACK | ||
is received with an error. | ||
- `connectTimeout`: `30 * 1000` milliseconds, time to wait before a | ||
@@ -421,0 +430,0 @@ CONNACK is received |
@@ -166,2 +166,8 @@ /** | ||
/** | ||
* Set to true to enable the reconnect period to apply if the initial | ||
* connection is denied with an error in the CONNACK packet, such as with an | ||
* authentication error. | ||
*/ | ||
reconnectOnConnackError?: boolean | ||
/** | ||
* 30 * 1000 milliseconds, time to wait before a CONNACK is received | ||
@@ -168,0 +174,0 @@ */ |
@@ -52,2 +52,5 @@ import { ReasonCodes } from './ack' | ||
client.emit('error', err) | ||
if (client.options.reconnectOnConnackError) { | ||
client['_cleanUp'](true) | ||
} | ||
} | ||
@@ -54,0 +57,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1862432
40
32422
971