mqtt 5.5.1 → 5.5.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/README.md +8 -0
- package/build/lib/BufferedDuplex.js +3 -2
- package/build/lib/BufferedDuplex.js.map +1 -1
- 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/get-timer.js +3 -1
- package/build/lib/get-timer.js.map +1 -1
- package/build/lib/is-browser.d.ts +1 -0
- package/build/lib/is-browser.js +2 -1
- package/build/lib/is-browser.js.map +1 -1
- package/build/lib/shared.d.ts +1 -0
- package/build/lib/shared.js +3 -2
- 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 +33 -14
- package/dist/mqtt.min.js +5 -5
- package/package.json +1 -1
- package/src/lib/BufferedDuplex.ts +1 -0
- package/src/lib/PingTimer.ts +20 -6
- package/src/lib/client.ts +6 -5
- package/src/lib/get-timer.ts +4 -2
- package/src/lib/is-browser.ts +2 -0
- package/src/lib/shared.ts +9 -5
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.3" };
|
|
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);
|
|
@@ -12670,9 +12677,10 @@ var mqtt = (() => {
|
|
|
12670
12677
|
}
|
|
12671
12678
|
}
|
|
12672
12679
|
exports5.applyMixin = applyMixin;
|
|
12673
|
-
exports5.nextTick = process_exports ? process_exports.nextTick : (callback) => {
|
|
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
|
|
|
@@ -17255,7 +17263,7 @@ var mqtt = (() => {
|
|
|
17255
17263
|
init_process2();
|
|
17256
17264
|
init_navigator();
|
|
17257
17265
|
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
17258
|
-
exports5.isWebWorker = void 0;
|
|
17266
|
+
exports5.isReactNativeBrowser = exports5.isWebWorker = void 0;
|
|
17259
17267
|
var isStandardBrowserEnv = () => typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
17260
17268
|
var isWebWorkerEnv = () => {
|
|
17261
17269
|
var _a, _b;
|
|
@@ -17264,6 +17272,7 @@ var mqtt = (() => {
|
|
|
17264
17272
|
var isReactNativeEnv = () => typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
17265
17273
|
var isBrowser = isStandardBrowserEnv() || isWebWorkerEnv() || isReactNativeEnv();
|
|
17266
17274
|
exports5.isWebWorker = isWebWorkerEnv();
|
|
17275
|
+
exports5.isReactNativeBrowser = isReactNativeEnv();
|
|
17267
17276
|
exports5.default = isBrowser;
|
|
17268
17277
|
}
|
|
17269
17278
|
});
|
|
@@ -17598,7 +17607,7 @@ var mqtt = (() => {
|
|
|
17598
17607
|
}
|
|
17599
17608
|
case "auto":
|
|
17600
17609
|
default: {
|
|
17601
|
-
return is_browser_1.default && !is_browser_1.isWebWorker ? workerTimer : nativeTimer;
|
|
17610
|
+
return is_browser_1.default && !is_browser_1.isWebWorker && !is_browser_1.isReactNativeBrowser ? workerTimer : nativeTimer;
|
|
17602
17611
|
}
|
|
17603
17612
|
}
|
|
17604
17613
|
};
|
|
@@ -17620,6 +17629,7 @@ var mqtt = (() => {
|
|
|
17620
17629
|
var get_timer_1 = __importDefault(require_get_timer());
|
|
17621
17630
|
var PingTimer = class {
|
|
17622
17631
|
constructor(keepalive, checkPing, variant) {
|
|
17632
|
+
this.destroyed = false;
|
|
17623
17633
|
this.keepalive = keepalive * 1e3;
|
|
17624
17634
|
this.checkPing = checkPing;
|
|
17625
17635
|
this.timer = (0, get_timer_1.default)(variant);
|
|
@@ -17631,13 +17641,21 @@ var mqtt = (() => {
|
|
|
17631
17641
|
this.timerId = null;
|
|
17632
17642
|
}
|
|
17633
17643
|
}
|
|
17644
|
+
destroy() {
|
|
17645
|
+
this.clear();
|
|
17646
|
+
this.destroyed = true;
|
|
17647
|
+
}
|
|
17634
17648
|
reschedule() {
|
|
17649
|
+
if (this.destroyed) {
|
|
17650
|
+
return;
|
|
17651
|
+
}
|
|
17635
17652
|
this.clear();
|
|
17636
17653
|
this.timerId = this.timer.set(() => {
|
|
17637
|
-
this.
|
|
17638
|
-
|
|
17639
|
-
this.reschedule();
|
|
17654
|
+
if (this.destroyed) {
|
|
17655
|
+
return;
|
|
17640
17656
|
}
|
|
17657
|
+
this.checkPing();
|
|
17658
|
+
this.reschedule();
|
|
17641
17659
|
}, this.keepalive);
|
|
17642
17660
|
}
|
|
17643
17661
|
};
|
|
@@ -17820,9 +17838,9 @@ var mqtt = (() => {
|
|
|
17820
17838
|
this.connected = false;
|
|
17821
17839
|
this.log("close :: clearing connackTimer");
|
|
17822
17840
|
clearTimeout(this.connackTimer);
|
|
17823
|
-
this.log("close ::
|
|
17841
|
+
this.log("close :: destroy ping timer");
|
|
17824
17842
|
if (this.pingTimer) {
|
|
17825
|
-
this.pingTimer.
|
|
17843
|
+
this.pingTimer.destroy();
|
|
17826
17844
|
this.pingTimer = null;
|
|
17827
17845
|
}
|
|
17828
17846
|
if (this.topicAliasRecv) {
|
|
@@ -18454,8 +18472,8 @@ var mqtt = (() => {
|
|
|
18454
18472
|
this._setupReconnect();
|
|
18455
18473
|
}
|
|
18456
18474
|
if (this.pingTimer) {
|
|
18457
|
-
this.log("_cleanUp ::
|
|
18458
|
-
this.pingTimer.
|
|
18475
|
+
this.log("_cleanUp :: destroy pingTimer");
|
|
18476
|
+
this.pingTimer.destroy();
|
|
18459
18477
|
this.pingTimer = null;
|
|
18460
18478
|
}
|
|
18461
18479
|
if (done && !this.connected) {
|
|
@@ -18787,7 +18805,7 @@ var mqtt = (() => {
|
|
|
18787
18805
|
});
|
|
18788
18806
|
}
|
|
18789
18807
|
};
|
|
18790
|
-
MqttClient.VERSION =
|
|
18808
|
+
MqttClient.VERSION = shared_1.MQTTJS_VERSION;
|
|
18791
18809
|
exports5.default = MqttClient;
|
|
18792
18810
|
}
|
|
18793
18811
|
});
|
|
@@ -20765,16 +20783,17 @@ var mqtt = (() => {
|
|
|
20765
20783
|
Object.defineProperty(exports5, "__esModule", { value: true });
|
|
20766
20784
|
exports5.BufferedDuplex = exports5.writev = void 0;
|
|
20767
20785
|
var readable_stream_1 = require_browser3();
|
|
20786
|
+
var buffer_1 = (init_buffer(), __toCommonJS(buffer_exports));
|
|
20768
20787
|
function writev(chunks, cb) {
|
|
20769
20788
|
const buffers = new Array(chunks.length);
|
|
20770
20789
|
for (let i6 = 0; i6 < chunks.length; i6++) {
|
|
20771
20790
|
if (typeof chunks[i6].chunk === "string") {
|
|
20772
|
-
buffers[i6] =
|
|
20791
|
+
buffers[i6] = buffer_1.Buffer.from(chunks[i6].chunk, "utf8");
|
|
20773
20792
|
} else {
|
|
20774
20793
|
buffers[i6] = chunks[i6].chunk;
|
|
20775
20794
|
}
|
|
20776
20795
|
}
|
|
20777
|
-
this._write(
|
|
20796
|
+
this._write(buffer_1.Buffer.concat(buffers), "binary", cb);
|
|
20778
20797
|
}
|
|
20779
20798
|
exports5.writev = writev;
|
|
20780
20799
|
var BufferedDuplex = class extends readable_stream_1.Duplex {
|