mqtt 5.5.2 → 5.5.4
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/README.md +8 -0
- package/build/lib/PingTimer.d.ts +3 -1
- package/build/lib/PingTimer.js +12 -3
- package/build/lib/PingTimer.js.map +1 -1
- package/build/lib/client.d.ts +1 -1
- package/build/lib/client.js +5 -5
- package/build/lib/client.js.map +1 -1
- package/build/lib/connect/index.js +3 -0
- package/build/lib/connect/index.js.map +1 -1
- package/build/lib/connect/tcp.js +2 -2
- package/build/lib/connect/tcp.js.map +1 -1
- package/build/lib/shared.d.ts +1 -0
- package/build/lib/shared.js +2 -1
- package/build/lib/shared.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/dist/mqtt.esm.js +5 -5
- package/dist/mqtt.js +35 -15
- package/dist/mqtt.min.js +5 -5
- package/package.json +1 -1
- package/src/lib/PingTimer.ts +20 -6
- package/src/lib/client.ts +6 -5
- package/src/lib/connect/index.ts +5 -0
- package/src/lib/connect/tcp.ts +2 -2
- package/src/lib/shared.ts +3 -0
package/dist/mqtt.js
CHANGED
|
@@ -12631,6 +12631,13 @@ var mqtt = (() => {
|
|
|
12631
12631
|
}
|
|
12632
12632
|
});
|
|
12633
12633
|
|
|
12634
|
+
// package-json:../../package.json
|
|
12635
|
+
var require_package = __commonJS({
|
|
12636
|
+
"package-json:../../package.json"(exports5, module) {
|
|
12637
|
+
module.exports = { version: "5.5.4" };
|
|
12638
|
+
}
|
|
12639
|
+
});
|
|
12640
|
+
|
|
12634
12641
|
// build/lib/shared.js
|
|
12635
12642
|
var require_shared = __commonJS({
|
|
12636
12643
|
"build/lib/shared.js"(exports5) {
|
|
@@ -12639,7 +12646,7 @@ var mqtt = (() => {
|
|
|
12639
12646
|
init_process2();
|
|
12640
12647
|
init_navigator();
|
|
12641
12648
|
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
12642
|
-
exports5.nextTick = exports5.applyMixin = exports5.ErrorWithReasonCode = void 0;
|
|
12649
|
+
exports5.MQTTJS_VERSION = exports5.nextTick = exports5.applyMixin = exports5.ErrorWithReasonCode = void 0;
|
|
12643
12650
|
var ErrorWithReasonCode = class _ErrorWithReasonCode extends Error {
|
|
12644
12651
|
constructor(message, code) {
|
|
12645
12652
|
super(message);
|
|
@@ -12673,6 +12680,7 @@ var mqtt = (() => {
|
|
|
12673
12680
|
exports5.nextTick = typeof (process_exports === null || process_exports === void 0 ? void 0 : process_exports.nextTick) === "function" ? process_exports.nextTick : (callback) => {
|
|
12674
12681
|
setTimeout(callback, 0);
|
|
12675
12682
|
};
|
|
12683
|
+
exports5.MQTTJS_VERSION = require_package().version;
|
|
12676
12684
|
}
|
|
12677
12685
|
});
|
|
12678
12686
|
|
|
@@ -17621,6 +17629,7 @@ var mqtt = (() => {
|
|
|
17621
17629
|
var get_timer_1 = __importDefault(require_get_timer());
|
|
17622
17630
|
var PingTimer = class {
|
|
17623
17631
|
constructor(keepalive, checkPing, variant) {
|
|
17632
|
+
this.destroyed = false;
|
|
17624
17633
|
this.keepalive = keepalive * 1e3;
|
|
17625
17634
|
this.checkPing = checkPing;
|
|
17626
17635
|
this.timer = (0, get_timer_1.default)(variant);
|
|
@@ -17632,13 +17641,21 @@ var mqtt = (() => {
|
|
|
17632
17641
|
this.timerId = null;
|
|
17633
17642
|
}
|
|
17634
17643
|
}
|
|
17644
|
+
destroy() {
|
|
17645
|
+
this.clear();
|
|
17646
|
+
this.destroyed = true;
|
|
17647
|
+
}
|
|
17635
17648
|
reschedule() {
|
|
17649
|
+
if (this.destroyed) {
|
|
17650
|
+
return;
|
|
17651
|
+
}
|
|
17636
17652
|
this.clear();
|
|
17637
17653
|
this.timerId = this.timer.set(() => {
|
|
17638
|
-
this.
|
|
17639
|
-
|
|
17640
|
-
this.reschedule();
|
|
17654
|
+
if (this.destroyed) {
|
|
17655
|
+
return;
|
|
17641
17656
|
}
|
|
17657
|
+
this.checkPing();
|
|
17658
|
+
this.reschedule();
|
|
17642
17659
|
}, this.keepalive);
|
|
17643
17660
|
}
|
|
17644
17661
|
};
|
|
@@ -17702,7 +17719,7 @@ var mqtt = (() => {
|
|
|
17702
17719
|
var TypedEmitter_1 = require_TypedEmitter();
|
|
17703
17720
|
var PingTimer_1 = __importDefault(require_PingTimer());
|
|
17704
17721
|
var is_browser_1 = __importStar(require_is_browser());
|
|
17705
|
-
var
|
|
17722
|
+
var setImmediate2 = globalThis.setImmediate || ((...args) => {
|
|
17706
17723
|
const callback = args.shift();
|
|
17707
17724
|
(0, shared_1.nextTick)(() => {
|
|
17708
17725
|
callback(...args);
|
|
@@ -17821,9 +17838,9 @@ var mqtt = (() => {
|
|
|
17821
17838
|
this.connected = false;
|
|
17822
17839
|
this.log("close :: clearing connackTimer");
|
|
17823
17840
|
clearTimeout(this.connackTimer);
|
|
17824
|
-
this.log("close ::
|
|
17841
|
+
this.log("close :: destroy ping timer");
|
|
17825
17842
|
if (this.pingTimer) {
|
|
17826
|
-
this.pingTimer.
|
|
17843
|
+
this.pingTimer.destroy();
|
|
17827
17844
|
this.pingTimer = null;
|
|
17828
17845
|
}
|
|
17829
17846
|
if (this.topicAliasRecv) {
|
|
@@ -18052,7 +18069,7 @@ var mqtt = (() => {
|
|
|
18052
18069
|
}
|
|
18053
18070
|
const invalidTopic = validations.validateTopics(topicsList);
|
|
18054
18071
|
if (invalidTopic !== null) {
|
|
18055
|
-
|
|
18072
|
+
setImmediate2(callback, new Error(`Invalid topic ${invalidTopic}`));
|
|
18056
18073
|
return this;
|
|
18057
18074
|
}
|
|
18058
18075
|
if (this._checkDisconnecting(callback)) {
|
|
@@ -18179,7 +18196,7 @@ var mqtt = (() => {
|
|
|
18179
18196
|
callback = callback || this.noop;
|
|
18180
18197
|
const invalidTopic = validations.validateTopics(topic);
|
|
18181
18198
|
if (invalidTopic !== null) {
|
|
18182
|
-
|
|
18199
|
+
setImmediate2(callback, new Error(`Invalid topic ${invalidTopic}`));
|
|
18183
18200
|
return this;
|
|
18184
18201
|
}
|
|
18185
18202
|
if (this._checkDisconnecting(callback)) {
|
|
@@ -18442,7 +18459,7 @@ var mqtt = (() => {
|
|
|
18442
18459
|
this.log("_cleanUp :: (%s) :: call _sendPacket with disconnect packet", this.options.clientId);
|
|
18443
18460
|
this._sendPacket(packet, () => {
|
|
18444
18461
|
this.log("_cleanUp :: (%s) :: destroying stream", this.options.clientId);
|
|
18445
|
-
|
|
18462
|
+
setImmediate2(() => {
|
|
18446
18463
|
this.stream.end(() => {
|
|
18447
18464
|
this.log("_cleanUp :: (%s) :: stream destroyed", this.options.clientId);
|
|
18448
18465
|
});
|
|
@@ -18455,8 +18472,8 @@ var mqtt = (() => {
|
|
|
18455
18472
|
this._setupReconnect();
|
|
18456
18473
|
}
|
|
18457
18474
|
if (this.pingTimer) {
|
|
18458
|
-
this.log("_cleanUp ::
|
|
18459
|
-
this.pingTimer.
|
|
18475
|
+
this.log("_cleanUp :: destroy pingTimer");
|
|
18476
|
+
this.pingTimer.destroy();
|
|
18460
18477
|
this.pingTimer = null;
|
|
18461
18478
|
}
|
|
18462
18479
|
if (done && !this.connected) {
|
|
@@ -18788,7 +18805,7 @@ var mqtt = (() => {
|
|
|
18788
18805
|
});
|
|
18789
18806
|
}
|
|
18790
18807
|
};
|
|
18791
|
-
MqttClient.VERSION =
|
|
18808
|
+
MqttClient.VERSION = shared_1.MQTTJS_VERSION;
|
|
18792
18809
|
exports5.default = MqttClient;
|
|
18793
18810
|
}
|
|
18794
18811
|
});
|
|
@@ -20687,10 +20704,10 @@ var mqtt = (() => {
|
|
|
20687
20704
|
var buildStream = (client, opts) => {
|
|
20688
20705
|
opts.port = opts.port || 1883;
|
|
20689
20706
|
opts.hostname = opts.hostname || opts.host || "localhost";
|
|
20690
|
-
const { port } = opts;
|
|
20707
|
+
const { port, path: path2 } = opts;
|
|
20691
20708
|
const host = opts.hostname;
|
|
20692
20709
|
debug("port %d and host %s", port, host);
|
|
20693
|
-
return net_1.default.createConnection(port, host);
|
|
20710
|
+
return net_1.default.createConnection({ port, host, path: path2 });
|
|
20694
20711
|
};
|
|
20695
20712
|
exports5.default = buildStream;
|
|
20696
20713
|
}
|
|
@@ -21313,6 +21330,9 @@ var mqtt = (() => {
|
|
|
21313
21330
|
var url_1 = __importDefault((init_url(), __toCommonJS(url_exports)));
|
|
21314
21331
|
var client_1 = __importDefault(require_client());
|
|
21315
21332
|
var is_browser_1 = __importDefault(require_is_browser());
|
|
21333
|
+
if (typeof (process_exports === null || process_exports === void 0 ? void 0 : process_exports.nextTick) !== "function") {
|
|
21334
|
+
process_exports.nextTick = setImmediate;
|
|
21335
|
+
}
|
|
21316
21336
|
var debug = (0, debug_1.default)("mqttjs");
|
|
21317
21337
|
var protocols = {};
|
|
21318
21338
|
if (!is_browser_1.default) {
|