mqtt 5.16.0 → 5.17.0
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 +75 -55
- package/build/bin/sub.js +1 -1
- package/build/bin/sub.js.map +1 -1
- package/build/lib/client.d.ts +6 -0
- package/build/lib/client.js +226 -8
- package/build/lib/client.js.map +1 -1
- package/build/lib/connect/index.js +50 -33
- package/build/lib/connect/index.js.map +1 -1
- package/build/lib/connect/tls.js +2 -4
- package/build/lib/connect/tls.js.map +1 -1
- package/build/lib/handlers/ack.js +9 -6
- package/build/lib/handlers/ack.js.map +1 -1
- package/build/lib/handlers/publish.js +1 -0
- package/build/lib/handlers/publish.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/dist/mqtt.esm.js +6 -6
- package/dist/mqtt.js +407 -340
- package/dist/mqtt.min.js +6 -6
- package/help/help.txt +2 -2
- package/help/publish.txt +6 -5
- package/help/subscribe.txt +6 -5
- package/package.json +1 -1
package/dist/mqtt.js
CHANGED
|
@@ -31,80 +31,6 @@ var mqtt = (() => {
|
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
// node_modules/@jspm/core/nodelibs/browser/process.js
|
|
34
|
-
var process_exports = {};
|
|
35
|
-
__export(process_exports, {
|
|
36
|
-
_debugEnd: () => _debugEnd,
|
|
37
|
-
_debugProcess: () => _debugProcess,
|
|
38
|
-
_events: () => _events,
|
|
39
|
-
_eventsCount: () => _eventsCount,
|
|
40
|
-
_exiting: () => _exiting,
|
|
41
|
-
_fatalExceptions: () => _fatalExceptions,
|
|
42
|
-
_getActiveHandles: () => _getActiveHandles,
|
|
43
|
-
_getActiveRequests: () => _getActiveRequests,
|
|
44
|
-
_kill: () => _kill,
|
|
45
|
-
_linkedBinding: () => _linkedBinding,
|
|
46
|
-
_maxListeners: () => _maxListeners,
|
|
47
|
-
_preload_modules: () => _preload_modules,
|
|
48
|
-
_rawDebug: () => _rawDebug,
|
|
49
|
-
_startProfilerIdleNotifier: () => _startProfilerIdleNotifier,
|
|
50
|
-
_stopProfilerIdleNotifier: () => _stopProfilerIdleNotifier,
|
|
51
|
-
_tickCallback: () => _tickCallback,
|
|
52
|
-
abort: () => abort,
|
|
53
|
-
addListener: () => addListener,
|
|
54
|
-
allowedNodeEnvironmentFlags: () => allowedNodeEnvironmentFlags,
|
|
55
|
-
arch: () => arch,
|
|
56
|
-
argv: () => argv,
|
|
57
|
-
argv0: () => argv0,
|
|
58
|
-
assert: () => assert,
|
|
59
|
-
binding: () => binding,
|
|
60
|
-
browser: () => browser,
|
|
61
|
-
chdir: () => chdir,
|
|
62
|
-
config: () => config,
|
|
63
|
-
cpuUsage: () => cpuUsage,
|
|
64
|
-
cwd: () => cwd,
|
|
65
|
-
debugPort: () => debugPort,
|
|
66
|
-
default: () => process,
|
|
67
|
-
dlopen: () => dlopen,
|
|
68
|
-
domain: () => domain,
|
|
69
|
-
emit: () => emit,
|
|
70
|
-
emitWarning: () => emitWarning,
|
|
71
|
-
env: () => env,
|
|
72
|
-
execArgv: () => execArgv,
|
|
73
|
-
execPath: () => execPath,
|
|
74
|
-
exit: () => exit,
|
|
75
|
-
features: () => features,
|
|
76
|
-
hasUncaughtExceptionCaptureCallback: () => hasUncaughtExceptionCaptureCallback,
|
|
77
|
-
hrtime: () => hrtime,
|
|
78
|
-
kill: () => kill,
|
|
79
|
-
listeners: () => listeners,
|
|
80
|
-
memoryUsage: () => memoryUsage,
|
|
81
|
-
moduleLoadList: () => moduleLoadList,
|
|
82
|
-
nextTick: () => nextTick,
|
|
83
|
-
off: () => off,
|
|
84
|
-
on: () => on,
|
|
85
|
-
once: () => once,
|
|
86
|
-
openStdin: () => openStdin,
|
|
87
|
-
pid: () => pid,
|
|
88
|
-
platform: () => platform,
|
|
89
|
-
ppid: () => ppid,
|
|
90
|
-
prependListener: () => prependListener,
|
|
91
|
-
prependOnceListener: () => prependOnceListener,
|
|
92
|
-
reallyExit: () => reallyExit,
|
|
93
|
-
release: () => release,
|
|
94
|
-
removeAllListeners: () => removeAllListeners,
|
|
95
|
-
removeListener: () => removeListener,
|
|
96
|
-
resourceUsage: () => resourceUsage,
|
|
97
|
-
setSourceMapsEnabled: () => setSourceMapsEnabled,
|
|
98
|
-
setUncaughtExceptionCaptureCallback: () => setUncaughtExceptionCaptureCallback,
|
|
99
|
-
stderr: () => stderr,
|
|
100
|
-
stdin: () => stdin,
|
|
101
|
-
stdout: () => stdout,
|
|
102
|
-
title: () => title,
|
|
103
|
-
umask: () => umask,
|
|
104
|
-
uptime: () => uptime,
|
|
105
|
-
version: () => version,
|
|
106
|
-
versions: () => versions
|
|
107
|
-
});
|
|
108
34
|
function unimplemented(name2) {
|
|
109
35
|
throw new Error("Node.js process " + name2 + " is not supported by JSPM core outside of Node.js");
|
|
110
36
|
}
|
|
@@ -395,10 +321,101 @@ var mqtt = (() => {
|
|
|
395
321
|
}
|
|
396
322
|
});
|
|
397
323
|
|
|
324
|
+
// scripts/browser-process.js
|
|
325
|
+
var browser_process_exports = {};
|
|
326
|
+
__export(browser_process_exports, {
|
|
327
|
+
_debugEnd: () => _debugEnd,
|
|
328
|
+
_debugProcess: () => _debugProcess,
|
|
329
|
+
_events: () => _events,
|
|
330
|
+
_eventsCount: () => _eventsCount,
|
|
331
|
+
_exiting: () => _exiting,
|
|
332
|
+
_fatalExceptions: () => _fatalExceptions,
|
|
333
|
+
_getActiveHandles: () => _getActiveHandles,
|
|
334
|
+
_getActiveRequests: () => _getActiveRequests,
|
|
335
|
+
_kill: () => _kill,
|
|
336
|
+
_linkedBinding: () => _linkedBinding,
|
|
337
|
+
_maxListeners: () => _maxListeners,
|
|
338
|
+
_preload_modules: () => _preload_modules,
|
|
339
|
+
_rawDebug: () => _rawDebug,
|
|
340
|
+
_startProfilerIdleNotifier: () => _startProfilerIdleNotifier,
|
|
341
|
+
_stopProfilerIdleNotifier: () => _stopProfilerIdleNotifier,
|
|
342
|
+
_tickCallback: () => _tickCallback,
|
|
343
|
+
abort: () => abort,
|
|
344
|
+
addListener: () => addListener,
|
|
345
|
+
allowedNodeEnvironmentFlags: () => allowedNodeEnvironmentFlags,
|
|
346
|
+
arch: () => arch,
|
|
347
|
+
argv: () => argv,
|
|
348
|
+
argv0: () => argv0,
|
|
349
|
+
assert: () => assert,
|
|
350
|
+
binding: () => binding,
|
|
351
|
+
browser: () => browser,
|
|
352
|
+
chdir: () => chdir,
|
|
353
|
+
config: () => config,
|
|
354
|
+
cpuUsage: () => cpuUsage,
|
|
355
|
+
cwd: () => cwd,
|
|
356
|
+
debugPort: () => debugPort,
|
|
357
|
+
default: () => browser_process_default,
|
|
358
|
+
dlopen: () => dlopen,
|
|
359
|
+
domain: () => domain,
|
|
360
|
+
emit: () => emit,
|
|
361
|
+
emitWarning: () => emitWarning,
|
|
362
|
+
env: () => env,
|
|
363
|
+
execArgv: () => execArgv,
|
|
364
|
+
execPath: () => execPath,
|
|
365
|
+
exit: () => exit,
|
|
366
|
+
features: () => features,
|
|
367
|
+
hasUncaughtExceptionCaptureCallback: () => hasUncaughtExceptionCaptureCallback,
|
|
368
|
+
hrtime: () => hrtime,
|
|
369
|
+
kill: () => kill,
|
|
370
|
+
listeners: () => listeners,
|
|
371
|
+
memoryUsage: () => memoryUsage,
|
|
372
|
+
moduleLoadList: () => moduleLoadList,
|
|
373
|
+
nextTick: () => nextTick2,
|
|
374
|
+
off: () => off,
|
|
375
|
+
on: () => on,
|
|
376
|
+
once: () => once,
|
|
377
|
+
openStdin: () => openStdin,
|
|
378
|
+
pid: () => pid,
|
|
379
|
+
platform: () => platform,
|
|
380
|
+
ppid: () => ppid,
|
|
381
|
+
prependListener: () => prependListener,
|
|
382
|
+
prependOnceListener: () => prependOnceListener,
|
|
383
|
+
reallyExit: () => reallyExit,
|
|
384
|
+
release: () => release,
|
|
385
|
+
removeAllListeners: () => removeAllListeners,
|
|
386
|
+
removeListener: () => removeListener,
|
|
387
|
+
resourceUsage: () => resourceUsage,
|
|
388
|
+
setSourceMapsEnabled: () => setSourceMapsEnabled,
|
|
389
|
+
setUncaughtExceptionCaptureCallback: () => setUncaughtExceptionCaptureCallback,
|
|
390
|
+
stderr: () => stderr,
|
|
391
|
+
stdin: () => stdin,
|
|
392
|
+
stdout: () => stdout,
|
|
393
|
+
title: () => title,
|
|
394
|
+
umask: () => umask,
|
|
395
|
+
uptime: () => uptime,
|
|
396
|
+
version: () => version,
|
|
397
|
+
versions: () => versions
|
|
398
|
+
});
|
|
399
|
+
function nextTick2(callback, ...args) {
|
|
400
|
+
schedule(() => callback(...args));
|
|
401
|
+
}
|
|
402
|
+
var schedule, browser_process_default;
|
|
403
|
+
var init_browser_process = __esm({
|
|
404
|
+
"scripts/browser-process.js"() {
|
|
405
|
+
init_dirname();
|
|
406
|
+
init_buffer2();
|
|
407
|
+
init_process2();
|
|
408
|
+
init_process();
|
|
409
|
+
init_process();
|
|
410
|
+
schedule = typeof queueMicrotask === "function" ? queueMicrotask : (fn) => setTimeout(fn, 0);
|
|
411
|
+
browser_process_default = { ...process, nextTick: nextTick2 };
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
|
|
398
415
|
// node_modules/esbuild-plugin-polyfill-node/polyfills/process.js
|
|
399
416
|
var init_process2 = __esm({
|
|
400
417
|
"node_modules/esbuild-plugin-polyfill-node/polyfills/process.js"() {
|
|
401
|
-
|
|
418
|
+
init_browser_process();
|
|
402
419
|
}
|
|
403
420
|
});
|
|
404
421
|
|
|
@@ -3545,171 +3562,6 @@ var mqtt = (() => {
|
|
|
3545
3562
|
}
|
|
3546
3563
|
});
|
|
3547
3564
|
|
|
3548
|
-
// node_modules/process/browser.js
|
|
3549
|
-
var require_browser2 = __commonJS({
|
|
3550
|
-
"node_modules/process/browser.js"(exports8, module) {
|
|
3551
|
-
init_dirname();
|
|
3552
|
-
init_buffer2();
|
|
3553
|
-
init_process2();
|
|
3554
|
-
var process3 = module.exports = {};
|
|
3555
|
-
var cachedSetTimeout;
|
|
3556
|
-
var cachedClearTimeout;
|
|
3557
|
-
function defaultSetTimout() {
|
|
3558
|
-
throw new Error("setTimeout has not been defined");
|
|
3559
|
-
}
|
|
3560
|
-
function defaultClearTimeout() {
|
|
3561
|
-
throw new Error("clearTimeout has not been defined");
|
|
3562
|
-
}
|
|
3563
|
-
(function() {
|
|
3564
|
-
try {
|
|
3565
|
-
if (typeof setTimeout === "function") {
|
|
3566
|
-
cachedSetTimeout = setTimeout;
|
|
3567
|
-
} else {
|
|
3568
|
-
cachedSetTimeout = defaultSetTimout;
|
|
3569
|
-
}
|
|
3570
|
-
} catch (e) {
|
|
3571
|
-
cachedSetTimeout = defaultSetTimout;
|
|
3572
|
-
}
|
|
3573
|
-
try {
|
|
3574
|
-
if (typeof clearTimeout === "function") {
|
|
3575
|
-
cachedClearTimeout = clearTimeout;
|
|
3576
|
-
} else {
|
|
3577
|
-
cachedClearTimeout = defaultClearTimeout;
|
|
3578
|
-
}
|
|
3579
|
-
} catch (e) {
|
|
3580
|
-
cachedClearTimeout = defaultClearTimeout;
|
|
3581
|
-
}
|
|
3582
|
-
})();
|
|
3583
|
-
function runTimeout(fun) {
|
|
3584
|
-
if (cachedSetTimeout === setTimeout) {
|
|
3585
|
-
return setTimeout(fun, 0);
|
|
3586
|
-
}
|
|
3587
|
-
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
3588
|
-
cachedSetTimeout = setTimeout;
|
|
3589
|
-
return setTimeout(fun, 0);
|
|
3590
|
-
}
|
|
3591
|
-
try {
|
|
3592
|
-
return cachedSetTimeout(fun, 0);
|
|
3593
|
-
} catch (e) {
|
|
3594
|
-
try {
|
|
3595
|
-
return cachedSetTimeout.call(null, fun, 0);
|
|
3596
|
-
} catch (e2) {
|
|
3597
|
-
return cachedSetTimeout.call(this, fun, 0);
|
|
3598
|
-
}
|
|
3599
|
-
}
|
|
3600
|
-
}
|
|
3601
|
-
function runClearTimeout(marker) {
|
|
3602
|
-
if (cachedClearTimeout === clearTimeout) {
|
|
3603
|
-
return clearTimeout(marker);
|
|
3604
|
-
}
|
|
3605
|
-
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
3606
|
-
cachedClearTimeout = clearTimeout;
|
|
3607
|
-
return clearTimeout(marker);
|
|
3608
|
-
}
|
|
3609
|
-
try {
|
|
3610
|
-
return cachedClearTimeout(marker);
|
|
3611
|
-
} catch (e) {
|
|
3612
|
-
try {
|
|
3613
|
-
return cachedClearTimeout.call(null, marker);
|
|
3614
|
-
} catch (e2) {
|
|
3615
|
-
return cachedClearTimeout.call(this, marker);
|
|
3616
|
-
}
|
|
3617
|
-
}
|
|
3618
|
-
}
|
|
3619
|
-
var queue3 = [];
|
|
3620
|
-
var draining3 = false;
|
|
3621
|
-
var currentQueue3;
|
|
3622
|
-
var queueIndex3 = -1;
|
|
3623
|
-
function cleanUpNextTick3() {
|
|
3624
|
-
if (!draining3 || !currentQueue3) {
|
|
3625
|
-
return;
|
|
3626
|
-
}
|
|
3627
|
-
draining3 = false;
|
|
3628
|
-
if (currentQueue3.length) {
|
|
3629
|
-
queue3 = currentQueue3.concat(queue3);
|
|
3630
|
-
} else {
|
|
3631
|
-
queueIndex3 = -1;
|
|
3632
|
-
}
|
|
3633
|
-
if (queue3.length) {
|
|
3634
|
-
drainQueue3();
|
|
3635
|
-
}
|
|
3636
|
-
}
|
|
3637
|
-
function drainQueue3() {
|
|
3638
|
-
if (draining3) {
|
|
3639
|
-
return;
|
|
3640
|
-
}
|
|
3641
|
-
var timeout = runTimeout(cleanUpNextTick3);
|
|
3642
|
-
draining3 = true;
|
|
3643
|
-
var len = queue3.length;
|
|
3644
|
-
while (len) {
|
|
3645
|
-
currentQueue3 = queue3;
|
|
3646
|
-
queue3 = [];
|
|
3647
|
-
while (++queueIndex3 < len) {
|
|
3648
|
-
if (currentQueue3) {
|
|
3649
|
-
currentQueue3[queueIndex3].run();
|
|
3650
|
-
}
|
|
3651
|
-
}
|
|
3652
|
-
queueIndex3 = -1;
|
|
3653
|
-
len = queue3.length;
|
|
3654
|
-
}
|
|
3655
|
-
currentQueue3 = null;
|
|
3656
|
-
draining3 = false;
|
|
3657
|
-
runClearTimeout(timeout);
|
|
3658
|
-
}
|
|
3659
|
-
process3.nextTick = function(fun) {
|
|
3660
|
-
var args = new Array(arguments.length - 1);
|
|
3661
|
-
if (arguments.length > 1) {
|
|
3662
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
3663
|
-
args[i - 1] = arguments[i];
|
|
3664
|
-
}
|
|
3665
|
-
}
|
|
3666
|
-
queue3.push(new Item3(fun, args));
|
|
3667
|
-
if (queue3.length === 1 && !draining3) {
|
|
3668
|
-
runTimeout(drainQueue3);
|
|
3669
|
-
}
|
|
3670
|
-
};
|
|
3671
|
-
function Item3(fun, array) {
|
|
3672
|
-
this.fun = fun;
|
|
3673
|
-
this.array = array;
|
|
3674
|
-
}
|
|
3675
|
-
Item3.prototype.run = function() {
|
|
3676
|
-
this.fun.apply(null, this.array);
|
|
3677
|
-
};
|
|
3678
|
-
process3.title = "browser";
|
|
3679
|
-
process3.browser = true;
|
|
3680
|
-
process3.env = {};
|
|
3681
|
-
process3.argv = [];
|
|
3682
|
-
process3.version = "";
|
|
3683
|
-
process3.versions = {};
|
|
3684
|
-
function noop3() {
|
|
3685
|
-
}
|
|
3686
|
-
process3.on = noop3;
|
|
3687
|
-
process3.addListener = noop3;
|
|
3688
|
-
process3.once = noop3;
|
|
3689
|
-
process3.off = noop3;
|
|
3690
|
-
process3.removeListener = noop3;
|
|
3691
|
-
process3.removeAllListeners = noop3;
|
|
3692
|
-
process3.emit = noop3;
|
|
3693
|
-
process3.prependListener = noop3;
|
|
3694
|
-
process3.prependOnceListener = noop3;
|
|
3695
|
-
process3.listeners = function(name2) {
|
|
3696
|
-
return [];
|
|
3697
|
-
};
|
|
3698
|
-
process3.binding = function(name2) {
|
|
3699
|
-
throw new Error("process.binding is not supported");
|
|
3700
|
-
};
|
|
3701
|
-
process3.cwd = function() {
|
|
3702
|
-
return "/";
|
|
3703
|
-
};
|
|
3704
|
-
process3.chdir = function(dir) {
|
|
3705
|
-
throw new Error("process.chdir is not supported");
|
|
3706
|
-
};
|
|
3707
|
-
process3.umask = function() {
|
|
3708
|
-
return 0;
|
|
3709
|
-
};
|
|
3710
|
-
}
|
|
3711
|
-
});
|
|
3712
|
-
|
|
3713
3565
|
// node_modules/readable-stream/lib/internal/streams/utils.js
|
|
3714
3566
|
var require_utils = __commonJS({
|
|
3715
3567
|
"node_modules/readable-stream/lib/internal/streams/utils.js"(exports8, module) {
|
|
@@ -3929,7 +3781,7 @@ var mqtt = (() => {
|
|
|
3929
3781
|
init_dirname();
|
|
3930
3782
|
init_buffer2();
|
|
3931
3783
|
init_process2();
|
|
3932
|
-
var process3 =
|
|
3784
|
+
var process3 = (init_browser_process(), __toCommonJS(browser_process_exports));
|
|
3933
3785
|
var { AbortError, codes } = require_errors();
|
|
3934
3786
|
var { ERR_INVALID_ARG_TYPE, ERR_STREAM_PREMATURE_CLOSE } = codes;
|
|
3935
3787
|
var { kEmptyObject, once: once4 } = require_util();
|
|
@@ -4184,7 +4036,7 @@ var mqtt = (() => {
|
|
|
4184
4036
|
init_dirname();
|
|
4185
4037
|
init_buffer2();
|
|
4186
4038
|
init_process2();
|
|
4187
|
-
var process3 =
|
|
4039
|
+
var process3 = (init_browser_process(), __toCommonJS(browser_process_exports));
|
|
4188
4040
|
var {
|
|
4189
4041
|
aggregateTwoErrors,
|
|
4190
4042
|
codes: { ERR_MULTIPLE_CALLBACK },
|
|
@@ -5092,7 +4944,7 @@ var mqtt = (() => {
|
|
|
5092
4944
|
init_dirname();
|
|
5093
4945
|
init_buffer2();
|
|
5094
4946
|
init_process2();
|
|
5095
|
-
var process3 =
|
|
4947
|
+
var process3 = (init_browser_process(), __toCommonJS(browser_process_exports));
|
|
5096
4948
|
var { PromisePrototypeThen, SymbolAsyncIterator, SymbolIterator } = require_primordials();
|
|
5097
4949
|
var { Buffer: Buffer3 } = (init_buffer(), __toCommonJS(buffer_exports));
|
|
5098
4950
|
var { ERR_INVALID_ARG_TYPE, ERR_STREAM_NULL_VALUES } = require_errors().codes;
|
|
@@ -5190,7 +5042,7 @@ var mqtt = (() => {
|
|
|
5190
5042
|
init_dirname();
|
|
5191
5043
|
init_buffer2();
|
|
5192
5044
|
init_process2();
|
|
5193
|
-
var process3 =
|
|
5045
|
+
var process3 = (init_browser_process(), __toCommonJS(browser_process_exports));
|
|
5194
5046
|
var {
|
|
5195
5047
|
ArrayPrototypeIndexOf,
|
|
5196
5048
|
NumberIsInteger,
|
|
@@ -6159,7 +6011,7 @@ var mqtt = (() => {
|
|
|
6159
6011
|
init_dirname();
|
|
6160
6012
|
init_buffer2();
|
|
6161
6013
|
init_process2();
|
|
6162
|
-
var process3 =
|
|
6014
|
+
var process3 = (init_browser_process(), __toCommonJS(browser_process_exports));
|
|
6163
6015
|
var {
|
|
6164
6016
|
ArrayPrototypeSlice,
|
|
6165
6017
|
Error: Error2,
|
|
@@ -6782,7 +6634,7 @@ var mqtt = (() => {
|
|
|
6782
6634
|
init_dirname();
|
|
6783
6635
|
init_buffer2();
|
|
6784
6636
|
init_process2();
|
|
6785
|
-
var process3 =
|
|
6637
|
+
var process3 = (init_browser_process(), __toCommonJS(browser_process_exports));
|
|
6786
6638
|
var bufferModule = (init_buffer(), __toCommonJS(buffer_exports));
|
|
6787
6639
|
var {
|
|
6788
6640
|
isReadable,
|
|
@@ -7379,7 +7231,7 @@ var mqtt = (() => {
|
|
|
7379
7231
|
init_dirname();
|
|
7380
7232
|
init_buffer2();
|
|
7381
7233
|
init_process2();
|
|
7382
|
-
var process3 =
|
|
7234
|
+
var process3 = (init_browser_process(), __toCommonJS(browser_process_exports));
|
|
7383
7235
|
var { ArrayIsArray, Promise: Promise2, SymbolAsyncIterator, SymbolDispose } = require_primordials();
|
|
7384
7236
|
var eos = require_end_of_stream();
|
|
7385
7237
|
var { once: once4 } = require_util();
|
|
@@ -8576,7 +8428,7 @@ var mqtt = (() => {
|
|
|
8576
8428
|
});
|
|
8577
8429
|
|
|
8578
8430
|
// node_modules/readable-stream/lib/ours/browser.js
|
|
8579
|
-
var
|
|
8431
|
+
var require_browser2 = __commonJS({
|
|
8580
8432
|
"node_modules/readable-stream/lib/ours/browser.js"(exports8, module) {
|
|
8581
8433
|
"use strict";
|
|
8582
8434
|
init_dirname();
|
|
@@ -8980,7 +8832,7 @@ var mqtt = (() => {
|
|
|
8980
8832
|
init_dirname();
|
|
8981
8833
|
init_buffer2();
|
|
8982
8834
|
init_process2();
|
|
8983
|
-
var DuplexStream =
|
|
8835
|
+
var DuplexStream = require_browser2().Duplex;
|
|
8984
8836
|
var inherits = require_inherits_browser();
|
|
8985
8837
|
var BufferList = require_BufferList();
|
|
8986
8838
|
function BufferListStream(callback) {
|
|
@@ -9644,7 +9496,7 @@ var mqtt = (() => {
|
|
|
9644
9496
|
});
|
|
9645
9497
|
|
|
9646
9498
|
// node_modules/debug/src/browser.js
|
|
9647
|
-
var
|
|
9499
|
+
var require_browser3 = __commonJS({
|
|
9648
9500
|
"node_modules/debug/src/browser.js"(exports8, module) {
|
|
9649
9501
|
init_dirname();
|
|
9650
9502
|
init_buffer2();
|
|
@@ -9793,8 +9645,8 @@ var mqtt = (() => {
|
|
|
9793
9645
|
r = exports8.storage.getItem("debug") || exports8.storage.getItem("DEBUG");
|
|
9794
9646
|
} catch (error) {
|
|
9795
9647
|
}
|
|
9796
|
-
if (!r && typeof
|
|
9797
|
-
r =
|
|
9648
|
+
if (!r && typeof browser_process_exports !== "undefined" && "env" in browser_process_exports) {
|
|
9649
|
+
r = browser_process_exports.env.DEBUG;
|
|
9798
9650
|
}
|
|
9799
9651
|
return r;
|
|
9800
9652
|
}
|
|
@@ -9826,7 +9678,7 @@ var mqtt = (() => {
|
|
|
9826
9678
|
var { EventEmitter: EventEmitter2 } = (init_events(), __toCommonJS(events_exports));
|
|
9827
9679
|
var Packet = require_packet();
|
|
9828
9680
|
var constants = require_constants();
|
|
9829
|
-
var debug =
|
|
9681
|
+
var debug = require_browser3()("mqtt-packet:parser");
|
|
9830
9682
|
var Parser = class _Parser extends EventEmitter2 {
|
|
9831
9683
|
constructor() {
|
|
9832
9684
|
super();
|
|
@@ -10549,12 +10401,12 @@ var mqtt = (() => {
|
|
|
10549
10401
|
init_dirname();
|
|
10550
10402
|
init_buffer2();
|
|
10551
10403
|
init_process2();
|
|
10552
|
-
if (typeof
|
|
10553
|
-
module.exports = { nextTick:
|
|
10404
|
+
if (typeof browser_process_exports === "undefined" || !browser_process_exports.version || browser_process_exports.version.indexOf("v0.") === 0 || browser_process_exports.version.indexOf("v1.") === 0 && browser_process_exports.version.indexOf("v1.8.") !== 0) {
|
|
10405
|
+
module.exports = { nextTick: nextTick4 };
|
|
10554
10406
|
} else {
|
|
10555
|
-
module.exports =
|
|
10407
|
+
module.exports = browser_process_exports;
|
|
10556
10408
|
}
|
|
10557
|
-
function
|
|
10409
|
+
function nextTick4(fn, arg1, arg2, arg3) {
|
|
10558
10410
|
if (typeof fn !== "function") {
|
|
10559
10411
|
throw new TypeError('"callback" argument must be a function');
|
|
10560
10412
|
}
|
|
@@ -10563,17 +10415,17 @@ var mqtt = (() => {
|
|
|
10563
10415
|
switch (len) {
|
|
10564
10416
|
case 0:
|
|
10565
10417
|
case 1:
|
|
10566
|
-
return
|
|
10418
|
+
return browser_process_exports.nextTick(fn);
|
|
10567
10419
|
case 2:
|
|
10568
|
-
return
|
|
10420
|
+
return browser_process_exports.nextTick(function afterTickOne() {
|
|
10569
10421
|
fn.call(null, arg1);
|
|
10570
10422
|
});
|
|
10571
10423
|
case 3:
|
|
10572
|
-
return
|
|
10424
|
+
return browser_process_exports.nextTick(function afterTickTwo() {
|
|
10573
10425
|
fn.call(null, arg1, arg2);
|
|
10574
10426
|
});
|
|
10575
10427
|
case 4:
|
|
10576
|
-
return
|
|
10428
|
+
return browser_process_exports.nextTick(function afterTickThree() {
|
|
10577
10429
|
fn.call(null, arg1, arg2, arg3);
|
|
10578
10430
|
});
|
|
10579
10431
|
default:
|
|
@@ -10582,7 +10434,7 @@ var mqtt = (() => {
|
|
|
10582
10434
|
while (i < args.length) {
|
|
10583
10435
|
args[i++] = arguments[i];
|
|
10584
10436
|
}
|
|
10585
|
-
return
|
|
10437
|
+
return browser_process_exports.nextTick(function afterTick() {
|
|
10586
10438
|
fn.apply(null, args);
|
|
10587
10439
|
});
|
|
10588
10440
|
}
|
|
@@ -10601,8 +10453,8 @@ var mqtt = (() => {
|
|
|
10601
10453
|
var empty2 = Buffer3.allocUnsafe(0);
|
|
10602
10454
|
var zeroBuf = Buffer3.from([0]);
|
|
10603
10455
|
var numbers = require_numbers();
|
|
10604
|
-
var
|
|
10605
|
-
var debug =
|
|
10456
|
+
var nextTick4 = require_process_nextick_args().nextTick;
|
|
10457
|
+
var debug = require_browser3()("mqtt-packet:writeToStream");
|
|
10606
10458
|
var numCache = numbers.cache;
|
|
10607
10459
|
var generateNumber = numbers.generateNumber;
|
|
10608
10460
|
var generateCache = numbers.generateCache;
|
|
@@ -10614,7 +10466,7 @@ var mqtt = (() => {
|
|
|
10614
10466
|
debug("generate called");
|
|
10615
10467
|
if (stream.cork) {
|
|
10616
10468
|
stream.cork();
|
|
10617
|
-
|
|
10469
|
+
nextTick4(uncork, stream);
|
|
10618
10470
|
}
|
|
10619
10471
|
if (toGenerate) {
|
|
10620
10472
|
toGenerate = false;
|
|
@@ -11777,7 +11629,7 @@ var mqtt = (() => {
|
|
|
11777
11629
|
init_buffer2();
|
|
11778
11630
|
init_process2();
|
|
11779
11631
|
Object.defineProperty(exports8, "__esModule", { value: true });
|
|
11780
|
-
var readable_stream_1 =
|
|
11632
|
+
var readable_stream_1 = require_browser2();
|
|
11781
11633
|
var streamsOpts = { objectMode: true };
|
|
11782
11634
|
var defaultStoreOptions = {
|
|
11783
11635
|
clean: true
|
|
@@ -11859,7 +11711,7 @@ var mqtt = (() => {
|
|
|
11859
11711
|
// package-json:../../package.json
|
|
11860
11712
|
var require_package = __commonJS({
|
|
11861
11713
|
"package-json:../../package.json"(exports8, module) {
|
|
11862
|
-
module.exports = { version: "5.
|
|
11714
|
+
module.exports = { version: "5.17.0" };
|
|
11863
11715
|
}
|
|
11864
11716
|
});
|
|
11865
11717
|
|
|
@@ -11912,7 +11764,7 @@ var mqtt = (() => {
|
|
|
11912
11764
|
}
|
|
11913
11765
|
}
|
|
11914
11766
|
}
|
|
11915
|
-
exports8.nextTick = typeof
|
|
11767
|
+
exports8.nextTick = typeof browser_process_exports?.nextTick === "function" ? browser_process_exports.nextTick : (callback) => {
|
|
11916
11768
|
setTimeout(callback, 0);
|
|
11917
11769
|
};
|
|
11918
11770
|
exports8.MQTTJS_VERSION = require_package().version;
|
|
@@ -11968,6 +11820,7 @@ var mqtt = (() => {
|
|
|
11968
11820
|
const gotTopic = topicAliasRecv.getTopicByAlias(alias);
|
|
11969
11821
|
if (gotTopic) {
|
|
11970
11822
|
topic = gotTopic;
|
|
11823
|
+
packet.topic = topic;
|
|
11971
11824
|
client.log("handlePublish :: topic complemented by alias. topic: %s - alias: %d", topic, alias);
|
|
11972
11825
|
} else {
|
|
11973
11826
|
client.log("handlePublish :: unregistered topic alias. alias: %d", alias);
|
|
@@ -12225,16 +12078,15 @@ var mqtt = (() => {
|
|
|
12225
12078
|
delete client.outgoing[messageId];
|
|
12226
12079
|
client.messageIdProvider.deallocate(messageId);
|
|
12227
12080
|
const granted = packet.granted;
|
|
12081
|
+
const topics = client.messageIdToTopic[messageId];
|
|
12228
12082
|
for (let grantedI = 0; grantedI < granted.length; grantedI++) {
|
|
12229
12083
|
const subackRC = granted[grantedI];
|
|
12230
12084
|
if ((subackRC & 128) !== 0) {
|
|
12231
12085
|
err = new Error(`Subscribe error: ${exports8.ReasonCodes[subackRC]}`);
|
|
12232
12086
|
err.code = subackRC;
|
|
12233
|
-
const
|
|
12234
|
-
if (
|
|
12235
|
-
|
|
12236
|
-
delete client["_resubscribeTopics"][topic];
|
|
12237
|
-
});
|
|
12087
|
+
const topic = topics?.[grantedI];
|
|
12088
|
+
if (topic !== void 0) {
|
|
12089
|
+
delete client["_resubscribeTopics"][topic];
|
|
12238
12090
|
}
|
|
12239
12091
|
}
|
|
12240
12092
|
}
|
|
@@ -12247,7 +12099,11 @@ var mqtt = (() => {
|
|
|
12247
12099
|
delete client.outgoing[messageId];
|
|
12248
12100
|
client.messageIdProvider.deallocate(messageId);
|
|
12249
12101
|
client["_invokeStoreProcessingQueue"]();
|
|
12250
|
-
|
|
12102
|
+
const unsubackRC = (packet.granted ?? []).find((rc) => (rc & 128) !== 0);
|
|
12103
|
+
if (unsubackRC !== void 0) {
|
|
12104
|
+
err = new shared_1.ErrorWithReasonCode(`Unsubscribe error: ${exports8.ReasonCodes[unsubackRC]}`, unsubackRC);
|
|
12105
|
+
}
|
|
12106
|
+
cb(err, packet);
|
|
12251
12107
|
break;
|
|
12252
12108
|
}
|
|
12253
12109
|
default:
|
|
@@ -12272,7 +12128,7 @@ var mqtt = (() => {
|
|
|
12272
12128
|
exports8.LRUCache = void 0;
|
|
12273
12129
|
var perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
|
|
12274
12130
|
var warned = /* @__PURE__ */ new Set();
|
|
12275
|
-
var PROCESS = typeof
|
|
12131
|
+
var PROCESS = typeof browser_process_exports === "object" && !!browser_process_exports ? browser_process_exports : {};
|
|
12276
12132
|
var emitWarning3 = (msg, type, code, fn) => {
|
|
12277
12133
|
typeof PROCESS.emitWarning === "function" ? PROCESS.emitWarning(msg, type, code, fn) : console.error(`[${code}] ${type}: ${msg}`);
|
|
12278
12134
|
};
|
|
@@ -14927,7 +14783,7 @@ var mqtt = (() => {
|
|
|
14927
14783
|
var symbol = Symbol();
|
|
14928
14784
|
var timerId = generateUniqueNumber(scheduledIntervalsState2);
|
|
14929
14785
|
scheduledIntervalsState2.set(timerId, symbol);
|
|
14930
|
-
var _schedule = function
|
|
14786
|
+
var _schedule = function schedule2() {
|
|
14931
14787
|
return set(delay, timerId).then(function() {
|
|
14932
14788
|
var state = scheduledIntervalsState2.get(timerId);
|
|
14933
14789
|
if (state === void 0) {
|
|
@@ -15091,8 +14947,8 @@ var mqtt = (() => {
|
|
|
15091
14947
|
var isStandardBrowserEnv = () => {
|
|
15092
14948
|
if (typeof window !== "undefined") {
|
|
15093
14949
|
const electronRenderCheck = typeof navigator !== "undefined" && navigator.userAgent?.toLowerCase().indexOf(" electron/") > -1;
|
|
15094
|
-
if (electronRenderCheck &&
|
|
15095
|
-
const electronMainCheck = Object.prototype.hasOwnProperty.call(
|
|
14950
|
+
if (electronRenderCheck && browser_process_exports?.versions) {
|
|
14951
|
+
const electronMainCheck = Object.prototype.hasOwnProperty.call(browser_process_exports.versions, "electron");
|
|
15096
14952
|
return !electronMainCheck;
|
|
15097
14953
|
}
|
|
15098
14954
|
return typeof window.document !== "undefined";
|
|
@@ -15310,9 +15166,9 @@ var mqtt = (() => {
|
|
|
15310
15166
|
};
|
|
15311
15167
|
Object.defineProperty(exports8, "__esModule", { value: true });
|
|
15312
15168
|
var mqtt_packet_1 = __importDefault(require_mqtt());
|
|
15313
|
-
var readable_stream_1 =
|
|
15169
|
+
var readable_stream_1 = require_browser2();
|
|
15314
15170
|
var default_1 = __importDefault(require_default());
|
|
15315
|
-
var debug_1 = __importDefault(
|
|
15171
|
+
var debug_1 = __importDefault(require_browser3());
|
|
15316
15172
|
var validations = __importStar(require_validations());
|
|
15317
15173
|
var store_1 = __importDefault(require_store());
|
|
15318
15174
|
var handlers_1 = __importDefault(require_handlers());
|
|
@@ -15331,6 +15187,57 @@ var mqtt = (() => {
|
|
|
15331
15187
|
});
|
|
15332
15188
|
var MAX_RECEIVE_MAXIMUM = 65535;
|
|
15333
15189
|
var RECEIVE_MAXIMUM_EXCEEDED = 147;
|
|
15190
|
+
var MALFORMED_PACKET = 129;
|
|
15191
|
+
var encodedSize = (packet, opts) => {
|
|
15192
|
+
let size = 0;
|
|
15193
|
+
const counter = {
|
|
15194
|
+
write(chunk) {
|
|
15195
|
+
size += typeof chunk === "string" ? Buffer2.byteLength(chunk) : chunk.length;
|
|
15196
|
+
return true;
|
|
15197
|
+
},
|
|
15198
|
+
destroy() {
|
|
15199
|
+
}
|
|
15200
|
+
};
|
|
15201
|
+
mqtt_packet_1.default.writeToStream(packet, counter, opts);
|
|
15202
|
+
return size;
|
|
15203
|
+
};
|
|
15204
|
+
var byteSize = (value) => {
|
|
15205
|
+
if (value == null) {
|
|
15206
|
+
return 0;
|
|
15207
|
+
}
|
|
15208
|
+
return typeof value === "string" || ArrayBuffer.isView(value) ? Buffer2.byteLength(value) : Infinity;
|
|
15209
|
+
};
|
|
15210
|
+
var userPropertySize = (key, value) => typeof value === "string" ? 5 + Buffer2.byteLength(key) + Buffer2.byteLength(value) : Infinity;
|
|
15211
|
+
var publishSizeUpperBound = (packet) => {
|
|
15212
|
+
const header = 1 + 4;
|
|
15213
|
+
const variable = 2 + 2 + 4 + 3;
|
|
15214
|
+
let size = header + variable + byteSize(packet.topic) + byteSize(packet.payload);
|
|
15215
|
+
const props = packet.properties;
|
|
15216
|
+
if (!props) {
|
|
15217
|
+
return size;
|
|
15218
|
+
}
|
|
15219
|
+
for (const name2 in props) {
|
|
15220
|
+
const value = props[name2];
|
|
15221
|
+
if (value == null)
|
|
15222
|
+
continue;
|
|
15223
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
15224
|
+
size += 5;
|
|
15225
|
+
} else if (name2 === "userProperties") {
|
|
15226
|
+
for (const key in value) {
|
|
15227
|
+
const v = value[key];
|
|
15228
|
+
if (!Array.isArray(v)) {
|
|
15229
|
+
size += userPropertySize(key, v);
|
|
15230
|
+
} else {
|
|
15231
|
+
for (const item of v)
|
|
15232
|
+
size += userPropertySize(key, item);
|
|
15233
|
+
}
|
|
15234
|
+
}
|
|
15235
|
+
} else {
|
|
15236
|
+
size += 3 + byteSize(value);
|
|
15237
|
+
}
|
|
15238
|
+
}
|
|
15239
|
+
return size;
|
|
15240
|
+
};
|
|
15334
15241
|
var defaultConnectOptions = {
|
|
15335
15242
|
keepalive: 60,
|
|
15336
15243
|
reschedulePings: true,
|
|
@@ -15514,7 +15421,20 @@ var mqtt = (() => {
|
|
|
15514
15421
|
callback();
|
|
15515
15422
|
}
|
|
15516
15423
|
_nextId() {
|
|
15517
|
-
|
|
15424
|
+
const skipped = [];
|
|
15425
|
+
let id = null;
|
|
15426
|
+
for (let attempt = 0; attempt < 65535; attempt++) {
|
|
15427
|
+
const candidate = this.messageIdProvider.allocate();
|
|
15428
|
+
if (candidate === null || !this.outgoing[candidate]) {
|
|
15429
|
+
id = candidate;
|
|
15430
|
+
break;
|
|
15431
|
+
}
|
|
15432
|
+
skipped.push(candidate);
|
|
15433
|
+
}
|
|
15434
|
+
for (const skippedId of skipped) {
|
|
15435
|
+
this.messageIdProvider.deallocate(skippedId);
|
|
15436
|
+
}
|
|
15437
|
+
return id;
|
|
15518
15438
|
}
|
|
15519
15439
|
getLastMessageId() {
|
|
15520
15440
|
return this.messageIdProvider.getLastAllocated();
|
|
@@ -15608,7 +15528,13 @@ var mqtt = (() => {
|
|
|
15608
15528
|
done();
|
|
15609
15529
|
}
|
|
15610
15530
|
};
|
|
15531
|
+
let parseFailed = false;
|
|
15611
15532
|
writable._write = (buf, enc, done) => {
|
|
15533
|
+
if (parseFailed) {
|
|
15534
|
+
this.log("writable stream :: dropping chunk after a parser error");
|
|
15535
|
+
done();
|
|
15536
|
+
return;
|
|
15537
|
+
}
|
|
15612
15538
|
completeParse = done;
|
|
15613
15539
|
this.log("writable stream :: parsing buffer");
|
|
15614
15540
|
parser.parse(buf);
|
|
@@ -15663,7 +15589,10 @@ var mqtt = (() => {
|
|
|
15663
15589
|
}
|
|
15664
15590
|
this._authenticationMethod = connectPacket.properties?.authenticationMethod;
|
|
15665
15591
|
this._writePacket(connectPacket);
|
|
15666
|
-
parser.on("error",
|
|
15592
|
+
parser.on("error", (err) => {
|
|
15593
|
+
parseFailed = true;
|
|
15594
|
+
this._onParserError(err, pump);
|
|
15595
|
+
});
|
|
15667
15596
|
if (this.options.properties) {
|
|
15668
15597
|
if (!this.options.properties.authenticationMethod && this.options.properties.authenticationData) {
|
|
15669
15598
|
this.end(() => this.emit("error", new Error("Packet has no Authentication Method")));
|
|
@@ -15683,6 +15612,25 @@ var mqtt = (() => {
|
|
|
15683
15612
|
this.connackTimer = setTimeout(() => this._onConnackTimeout(), this.options.connectTimeout);
|
|
15684
15613
|
return this;
|
|
15685
15614
|
}
|
|
15615
|
+
_onParserError(err, pump) {
|
|
15616
|
+
pump.discardParsedPackets();
|
|
15617
|
+
if (pump.isCurrent()) {
|
|
15618
|
+
this.log("_onParserError :: malformed packet, closing: %s", err.message);
|
|
15619
|
+
if (this.options.protocolVersion === 5 && !this.disconnecting && this.stream.writable) {
|
|
15620
|
+
this._writePacket({
|
|
15621
|
+
cmd: "disconnect",
|
|
15622
|
+
reasonCode: MALFORMED_PACKET
|
|
15623
|
+
});
|
|
15624
|
+
do {
|
|
15625
|
+
this.stream.uncork();
|
|
15626
|
+
} while (this.stream.writableCorked > 0);
|
|
15627
|
+
}
|
|
15628
|
+
this._cleanUp(true);
|
|
15629
|
+
} else {
|
|
15630
|
+
this.log("_onParserError :: stale connection: %s", err.message);
|
|
15631
|
+
}
|
|
15632
|
+
this.emit("error", new shared_1.ErrorWithReasonCode(`${ack_1.ReasonCodes[MALFORMED_PACKET]}: ${err.message}`, MALFORMED_PACKET));
|
|
15633
|
+
}
|
|
15686
15634
|
_onConnackTimeout() {
|
|
15687
15635
|
this.log("!!connectTimeout hit!! Calling _cleanUp with force `true`");
|
|
15688
15636
|
this._cleanUp(true);
|
|
@@ -15722,7 +15670,7 @@ var mqtt = (() => {
|
|
|
15722
15670
|
qos,
|
|
15723
15671
|
retain,
|
|
15724
15672
|
messageId,
|
|
15725
|
-
dup
|
|
15673
|
+
dup: qos === 1 || qos === 2 ? dup : false
|
|
15726
15674
|
};
|
|
15727
15675
|
if (options.protocolVersion === 5) {
|
|
15728
15676
|
packet.properties = properties;
|
|
@@ -16154,7 +16102,7 @@ var mqtt = (() => {
|
|
|
16154
16102
|
_reconnect() {
|
|
16155
16103
|
this.log("_reconnect: emitting reconnect to client");
|
|
16156
16104
|
this.emit("reconnect");
|
|
16157
|
-
if (this.connected) {
|
|
16105
|
+
if (this.connected && !this.stream.destroyed) {
|
|
16158
16106
|
this.end(() => {
|
|
16159
16107
|
this.connect();
|
|
16160
16108
|
});
|
|
@@ -16229,7 +16177,7 @@ var mqtt = (() => {
|
|
|
16229
16177
|
let storePacket = packet;
|
|
16230
16178
|
let err;
|
|
16231
16179
|
if (storePacket.cmd === "publish") {
|
|
16232
|
-
storePacket = (0, default_1.default)(packet);
|
|
16180
|
+
storePacket = { ...(0, default_1.default)(packet), dup: true };
|
|
16233
16181
|
err = this._removeTopicAliasAndRecoverTopicName(storePacket);
|
|
16234
16182
|
if (err) {
|
|
16235
16183
|
return cb && cb(err);
|
|
@@ -16251,6 +16199,10 @@ var mqtt = (() => {
|
|
|
16251
16199
|
alias = packet.properties.topicAlias;
|
|
16252
16200
|
}
|
|
16253
16201
|
const topic = packet.topic.toString();
|
|
16202
|
+
if (alias === 0) {
|
|
16203
|
+
this.log("applyTopicAlias :: error out of range. topic: %s - alias: %d", topic, alias);
|
|
16204
|
+
return new Error("Sending Topic Alias out of range");
|
|
16205
|
+
}
|
|
16254
16206
|
if (this.topicAliasSend) {
|
|
16255
16207
|
if (alias) {
|
|
16256
16208
|
if (topic.length !== 0) {
|
|
@@ -16298,6 +16250,70 @@ var mqtt = (() => {
|
|
|
16298
16250
|
}
|
|
16299
16251
|
}
|
|
16300
16252
|
}
|
|
16253
|
+
_checkOutgoingPublish(packet) {
|
|
16254
|
+
if (this.options.protocolVersion !== 5 || packet.cmd !== "publish") {
|
|
16255
|
+
return void 0;
|
|
16256
|
+
}
|
|
16257
|
+
if (packet.properties?.subscriptionIdentifier !== void 0) {
|
|
16258
|
+
return new Error("Publish refused: a client must not send a Subscription Identifier");
|
|
16259
|
+
}
|
|
16260
|
+
const server = this._serverProperties;
|
|
16261
|
+
if (!server || !this.connected) {
|
|
16262
|
+
return void 0;
|
|
16263
|
+
}
|
|
16264
|
+
if (server.maximumQoS !== void 0 && packet.qos > server.maximumQoS) {
|
|
16265
|
+
return new Error(`Publish refused: QoS ${packet.qos} exceeds the server Maximum QoS ${server.maximumQoS}`);
|
|
16266
|
+
}
|
|
16267
|
+
if (packet.retain && server.retainAvailable === false) {
|
|
16268
|
+
return new Error("Publish refused: the server does not support retained messages (Retain Available is 0)");
|
|
16269
|
+
}
|
|
16270
|
+
if (server.maximumPacketSize && publishSizeUpperBound(packet) > server.maximumPacketSize) {
|
|
16271
|
+
const size = encodedSize(this._publishAsSent(packet), this.options);
|
|
16272
|
+
if (size > server.maximumPacketSize) {
|
|
16273
|
+
return new Error(`Publish refused: packet size ${size} exceeds the server Maximum Packet Size ${server.maximumPacketSize}`);
|
|
16274
|
+
}
|
|
16275
|
+
}
|
|
16276
|
+
return void 0;
|
|
16277
|
+
}
|
|
16278
|
+
_publishAsSent(packet) {
|
|
16279
|
+
const topic = packet.topic.toString();
|
|
16280
|
+
const { autoAssignTopicAlias, autoUseTopicAlias } = this.options;
|
|
16281
|
+
if (!this.topicAliasSend || topic.length === 0 || packet.properties?.topicAlias || !(autoAssignTopicAlias || autoUseTopicAlias)) {
|
|
16282
|
+
return packet;
|
|
16283
|
+
}
|
|
16284
|
+
const alias = this.topicAliasSend.getAliasByTopic(topic);
|
|
16285
|
+
if (alias) {
|
|
16286
|
+
return {
|
|
16287
|
+
...packet,
|
|
16288
|
+
topic: "",
|
|
16289
|
+
properties: { ...packet.properties, topicAlias: alias }
|
|
16290
|
+
};
|
|
16291
|
+
}
|
|
16292
|
+
if (!autoAssignTopicAlias) {
|
|
16293
|
+
return packet;
|
|
16294
|
+
}
|
|
16295
|
+
return {
|
|
16296
|
+
...packet,
|
|
16297
|
+
properties: { ...packet.properties, topicAlias: 1 }
|
|
16298
|
+
};
|
|
16299
|
+
}
|
|
16300
|
+
_failPublish(packet, err, cb) {
|
|
16301
|
+
this.log("_failPublish :: %s", err.message);
|
|
16302
|
+
const { messageId } = packet;
|
|
16303
|
+
const entry = packet.qos > 0 ? this.outgoing[messageId] : void 0;
|
|
16304
|
+
if (!entry) {
|
|
16305
|
+
cb(err);
|
|
16306
|
+
return;
|
|
16307
|
+
}
|
|
16308
|
+
delete this.outgoing[messageId];
|
|
16309
|
+
this.outgoingStore.del({ messageId }, () => {
|
|
16310
|
+
this.messageIdProvider.deallocate(messageId);
|
|
16311
|
+
setImmediate2(() => {
|
|
16312
|
+
entry.cb(err);
|
|
16313
|
+
this._invokeStoreProcessingQueue();
|
|
16314
|
+
});
|
|
16315
|
+
});
|
|
16316
|
+
}
|
|
16301
16317
|
_noop(err) {
|
|
16302
16318
|
this.log("noop ::", err);
|
|
16303
16319
|
}
|
|
@@ -16320,9 +16336,9 @@ var mqtt = (() => {
|
|
|
16320
16336
|
this.log("_sendPacket :: (%s) :: start", this.options.clientId);
|
|
16321
16337
|
cbStorePut = cbStorePut || this.noop;
|
|
16322
16338
|
cb = cb || this.noop;
|
|
16323
|
-
const err = this._applyTopicAlias(packet);
|
|
16339
|
+
const err = this._checkOutgoingPublish(packet) || this._applyTopicAlias(packet);
|
|
16324
16340
|
if (err) {
|
|
16325
|
-
|
|
16341
|
+
this._failPublish(packet, err, cb);
|
|
16326
16342
|
return;
|
|
16327
16343
|
}
|
|
16328
16344
|
if (!this.connected) {
|
|
@@ -16460,6 +16476,10 @@ var mqtt = (() => {
|
|
|
16460
16476
|
if (!sessionResumed) {
|
|
16461
16477
|
this._discardIncomingQoS2State();
|
|
16462
16478
|
}
|
|
16479
|
+
const discardOutgoingSession = this.options.protocolVersion === 5 && !this.options.clean && !sessionResumed;
|
|
16480
|
+
if (discardOutgoingSession) {
|
|
16481
|
+
this.log("_onConnect :: session not resumed, dropping sent messages from the outgoing store");
|
|
16482
|
+
}
|
|
16463
16483
|
this.messageIdProvider.clear();
|
|
16464
16484
|
this.connected = true;
|
|
16465
16485
|
this._setupKeepaliveManager();
|
|
@@ -16497,6 +16517,11 @@ var mqtt = (() => {
|
|
|
16497
16517
|
storeDeliver();
|
|
16498
16518
|
return;
|
|
16499
16519
|
}
|
|
16520
|
+
const neverSent = packet2.cmd === "publish" && !packet2.dup;
|
|
16521
|
+
if (discardOutgoingSession && !neverSent) {
|
|
16522
|
+
this._discardOutgoingSessionPacket(packet2, storeDeliver);
|
|
16523
|
+
return;
|
|
16524
|
+
}
|
|
16500
16525
|
if (!this.disconnecting && !this.reconnectTimer) {
|
|
16501
16526
|
cb = this.outgoing[packet2.messageId] ? this.outgoing[packet2.messageId].cb : null;
|
|
16502
16527
|
this.outgoing[packet2.messageId] = {
|
|
@@ -16511,7 +16536,11 @@ var mqtt = (() => {
|
|
|
16511
16536
|
};
|
|
16512
16537
|
this._packetIdsDuringStoreProcessing[packet2.messageId] = true;
|
|
16513
16538
|
if (this.messageIdProvider.register(packet2.messageId)) {
|
|
16514
|
-
|
|
16539
|
+
if (neverSent) {
|
|
16540
|
+
this._sendNeverSentPacket(packet2);
|
|
16541
|
+
} else {
|
|
16542
|
+
this._sendPacket(packet2, void 0, void 0, true);
|
|
16543
|
+
}
|
|
16515
16544
|
} else {
|
|
16516
16545
|
this.log("messageId: %d has already used.", packet2.messageId);
|
|
16517
16546
|
}
|
|
@@ -16563,6 +16592,30 @@ var mqtt = (() => {
|
|
|
16563
16592
|
}
|
|
16564
16593
|
this._storeProcessingQueue.splice(0);
|
|
16565
16594
|
}
|
|
16595
|
+
_sendNeverSentPacket(packet) {
|
|
16596
|
+
this.outgoingStore.put({ ...packet, dup: true }, (err) => {
|
|
16597
|
+
if (err) {
|
|
16598
|
+
this.log("_sendNeverSentPacket :: put error for messageId %d, sending anyway: %o", packet.messageId, err);
|
|
16599
|
+
}
|
|
16600
|
+
this._sendPacket(packet, void 0, void 0, true);
|
|
16601
|
+
});
|
|
16602
|
+
}
|
|
16603
|
+
_discardOutgoingSessionPacket(packet, next) {
|
|
16604
|
+
const { messageId } = packet;
|
|
16605
|
+
const pending = this.outgoing[messageId];
|
|
16606
|
+
delete this.outgoing[messageId];
|
|
16607
|
+
this._packetIdsDuringStoreProcessing[messageId] = true;
|
|
16608
|
+
this.log("_discardOutgoingSessionPacket :: session not resumed, dropping %s %d (topic %s, %s)", packet.cmd, messageId, packet.topic, pending ? "callback failed" : "no pending callback");
|
|
16609
|
+
this.outgoingStore.del({ messageId }, (err) => {
|
|
16610
|
+
if (err) {
|
|
16611
|
+
this.log("_discardOutgoingSessionPacket :: del error for messageId %d: %o", messageId, err);
|
|
16612
|
+
}
|
|
16613
|
+
if (pending) {
|
|
16614
|
+
pending.cb(new Error(packet.cmd === "pubrel" ? "Session lost (Session Present 0) before PUBCOMP: the delivery outcome of the QoS 2 message is unknown" : "Session lost (Session Present 0): the message was sent but not acknowledged, and is not sent again"));
|
|
16615
|
+
}
|
|
16616
|
+
(0, shared_1.nextTick)(next);
|
|
16617
|
+
});
|
|
16618
|
+
}
|
|
16566
16619
|
_removeOutgoingAndStoreMessage(messageId, cb) {
|
|
16567
16620
|
delete this.outgoing[messageId];
|
|
16568
16621
|
this.outgoingStore.del({ messageId }, (err, packet) => {
|
|
@@ -17675,7 +17728,7 @@ var mqtt = (() => {
|
|
|
17675
17728
|
draining2 = false;
|
|
17676
17729
|
clearTimeout(timeout);
|
|
17677
17730
|
}
|
|
17678
|
-
function
|
|
17731
|
+
function nextTick3(fun) {
|
|
17679
17732
|
var args = new Array(arguments.length - 1);
|
|
17680
17733
|
if (arguments.length > 1) {
|
|
17681
17734
|
for (var i = 1; i < arguments.length; i++)
|
|
@@ -17899,7 +17952,7 @@ var mqtt = (() => {
|
|
|
17899
17952
|
setUncaughtExceptionCaptureCallback: setUncaughtExceptionCaptureCallback2,
|
|
17900
17953
|
hasUncaughtExceptionCaptureCallback: hasUncaughtExceptionCaptureCallback2,
|
|
17901
17954
|
emitWarning: emitWarning2,
|
|
17902
|
-
nextTick:
|
|
17955
|
+
nextTick: nextTick3,
|
|
17903
17956
|
_tickCallback: _tickCallback2,
|
|
17904
17957
|
_debugProcess: _debugProcess2,
|
|
17905
17958
|
_debugEnd: _debugEnd2,
|
|
@@ -20332,7 +20385,7 @@ var mqtt = (() => {
|
|
|
20332
20385
|
});
|
|
20333
20386
|
|
|
20334
20387
|
// node_modules/ws/browser.js
|
|
20335
|
-
var
|
|
20388
|
+
var require_browser4 = __commonJS({
|
|
20336
20389
|
"node_modules/ws/browser.js"(exports8, module) {
|
|
20337
20390
|
"use strict";
|
|
20338
20391
|
init_dirname();
|
|
@@ -20356,7 +20409,7 @@ var mqtt = (() => {
|
|
|
20356
20409
|
Object.defineProperty(exports8, "__esModule", { value: true });
|
|
20357
20410
|
exports8.BufferedDuplex = void 0;
|
|
20358
20411
|
exports8.writev = writev;
|
|
20359
|
-
var readable_stream_1 =
|
|
20412
|
+
var readable_stream_1 = require_browser2();
|
|
20360
20413
|
var buffer_1 = (init_buffer(), __toCommonJS(buffer_exports));
|
|
20361
20414
|
function writev(chunks, cb) {
|
|
20362
20415
|
const buffers = new Array(chunks.length);
|
|
@@ -20446,9 +20499,9 @@ var mqtt = (() => {
|
|
|
20446
20499
|
Object.defineProperty(exports8, "__esModule", { value: true });
|
|
20447
20500
|
exports8.streamBuilder = exports8.browserStreamBuilder = void 0;
|
|
20448
20501
|
var buffer_1 = (init_buffer(), __toCommonJS(buffer_exports));
|
|
20449
|
-
var ws_1 = __importDefault(
|
|
20450
|
-
var debug_1 = __importDefault(
|
|
20451
|
-
var readable_stream_1 =
|
|
20502
|
+
var ws_1 = __importDefault(require_browser4());
|
|
20503
|
+
var debug_1 = __importDefault(require_browser3());
|
|
20504
|
+
var readable_stream_1 = require_browser2();
|
|
20452
20505
|
var is_browser_1 = __importDefault(require_is_browser());
|
|
20453
20506
|
var BufferedDuplex_1 = require_BufferedDuplex();
|
|
20454
20507
|
var debug = (0, debug_1.default)("mqttjs:ws");
|
|
@@ -20714,7 +20767,7 @@ var mqtt = (() => {
|
|
|
20714
20767
|
};
|
|
20715
20768
|
Object.defineProperty(exports8, "__esModule", { value: true });
|
|
20716
20769
|
var net_1 = __importDefault((init_net(), __toCommonJS(net_exports)));
|
|
20717
|
-
var debug_1 = __importDefault(
|
|
20770
|
+
var debug_1 = __importDefault(require_browser3());
|
|
20718
20771
|
var socks_1 = __importDefault(require_socks());
|
|
20719
20772
|
var debug = (0, debug_1.default)("mqttjs:tcp");
|
|
20720
20773
|
var buildStream = (client, opts) => {
|
|
@@ -20762,7 +20815,7 @@ var mqtt = (() => {
|
|
|
20762
20815
|
Object.defineProperty(exports8, "__esModule", { value: true });
|
|
20763
20816
|
var tls_1 = (init_empty(), __toCommonJS(empty_exports));
|
|
20764
20817
|
var net_1 = __importDefault((init_net(), __toCommonJS(net_exports)));
|
|
20765
|
-
var debug_1 = __importDefault(
|
|
20818
|
+
var debug_1 = __importDefault(require_browser3());
|
|
20766
20819
|
var socks_1 = __importDefault(require_socks());
|
|
20767
20820
|
var debug = (0, debug_1.default)("mqttjs:tls");
|
|
20768
20821
|
function connect(opts) {
|
|
@@ -20781,13 +20834,11 @@ var mqtt = (() => {
|
|
|
20781
20834
|
var buildStream = (client, opts) => {
|
|
20782
20835
|
opts.port = opts.port || 8883;
|
|
20783
20836
|
opts.host = opts.hostname || opts.host || "localhost";
|
|
20784
|
-
if (net_1.default.isIP(opts.host) === 0 && !opts.servername) {
|
|
20785
|
-
opts.servername = opts.host;
|
|
20786
|
-
}
|
|
20787
20837
|
opts.rejectUnauthorized = opts.rejectUnauthorized !== false;
|
|
20788
20838
|
delete opts.path;
|
|
20789
20839
|
debug("port %d host %s rejectUnauthorized %b", opts.port, opts.host, opts.rejectUnauthorized);
|
|
20790
|
-
const
|
|
20840
|
+
const servername = opts.servername || (net_1.default.isIP(opts.host) === 0 ? opts.host : void 0);
|
|
20841
|
+
const connection = connect({ ...opts, servername });
|
|
20791
20842
|
connection.on("secureConnect", () => {
|
|
20792
20843
|
if (opts.rejectUnauthorized && !connection.authorized) {
|
|
20793
20844
|
connection.emit("error", new Error("TLS not authorized"));
|
|
@@ -20817,7 +20868,7 @@ var mqtt = (() => {
|
|
|
20817
20868
|
init_process2();
|
|
20818
20869
|
Object.defineProperty(exports8, "__esModule", { value: true });
|
|
20819
20870
|
var buffer_1 = (init_buffer(), __toCommonJS(buffer_exports));
|
|
20820
|
-
var readable_stream_1 =
|
|
20871
|
+
var readable_stream_1 = require_browser2();
|
|
20821
20872
|
var BufferedDuplex_1 = require_BufferedDuplex();
|
|
20822
20873
|
var socketTask;
|
|
20823
20874
|
var proxy;
|
|
@@ -20938,7 +20989,7 @@ var mqtt = (() => {
|
|
|
20938
20989
|
init_process2();
|
|
20939
20990
|
Object.defineProperty(exports8, "__esModule", { value: true });
|
|
20940
20991
|
var buffer_1 = (init_buffer(), __toCommonJS(buffer_exports));
|
|
20941
|
-
var readable_stream_1 =
|
|
20992
|
+
var readable_stream_1 = require_browser2();
|
|
20942
20993
|
var BufferedDuplex_1 = require_BufferedDuplex();
|
|
20943
20994
|
var my;
|
|
20944
20995
|
var proxy;
|
|
@@ -21053,15 +21104,42 @@ var mqtt = (() => {
|
|
|
21053
21104
|
};
|
|
21054
21105
|
Object.defineProperty(exports8, "__esModule", { value: true });
|
|
21055
21106
|
exports8.connectAsync = connectAsync;
|
|
21056
|
-
var debug_1 = __importDefault(
|
|
21107
|
+
var debug_1 = __importDefault(require_browser3());
|
|
21057
21108
|
var url_1 = __importDefault((init_url(), __toCommonJS(url_exports)));
|
|
21058
21109
|
var client_1 = __importDefault(require_client());
|
|
21059
21110
|
var is_browser_1 = __importDefault(require_is_browser());
|
|
21060
|
-
if (typeof
|
|
21061
|
-
|
|
21111
|
+
if (typeof browser_process_exports?.nextTick !== "function") {
|
|
21112
|
+
browser_process_exports.nextTick = setImmediate;
|
|
21062
21113
|
}
|
|
21063
21114
|
var debug = (0, debug_1.default)("mqttjs");
|
|
21064
|
-
var
|
|
21115
|
+
var nodeProtocols = null;
|
|
21116
|
+
var browserProtocols = null;
|
|
21117
|
+
function loadNodeProtocols() {
|
|
21118
|
+
if (!nodeProtocols) {
|
|
21119
|
+
nodeProtocols = {};
|
|
21120
|
+
nodeProtocols.ws = require_ws().streamBuilder;
|
|
21121
|
+
nodeProtocols.wss = require_ws().streamBuilder;
|
|
21122
|
+
nodeProtocols.mqtt = require_tcp().default;
|
|
21123
|
+
nodeProtocols.tcp = require_tcp().default;
|
|
21124
|
+
nodeProtocols.ssl = require_tls().default;
|
|
21125
|
+
nodeProtocols.tls = nodeProtocols.ssl;
|
|
21126
|
+
nodeProtocols.mqtts = require_tls().default;
|
|
21127
|
+
}
|
|
21128
|
+
return nodeProtocols;
|
|
21129
|
+
}
|
|
21130
|
+
function loadBrowserProtocols() {
|
|
21131
|
+
if (!browserProtocols) {
|
|
21132
|
+
browserProtocols = {};
|
|
21133
|
+
browserProtocols.ws = require_ws().browserStreamBuilder;
|
|
21134
|
+
browserProtocols.wss = require_ws().browserStreamBuilder;
|
|
21135
|
+
browserProtocols.wx = require_wx().default;
|
|
21136
|
+
browserProtocols.wxs = require_wx().default;
|
|
21137
|
+
browserProtocols.ali = require_ali().default;
|
|
21138
|
+
browserProtocols.alis = require_ali().default;
|
|
21139
|
+
}
|
|
21140
|
+
return browserProtocols;
|
|
21141
|
+
}
|
|
21142
|
+
var SECURE_PROTOCOLS = ["mqtts", "tls", "ssl", "wss", "wxs", "alis"];
|
|
21065
21143
|
function getDefaultWebSocketProtocol() {
|
|
21066
21144
|
if (typeof location !== "undefined") {
|
|
21067
21145
|
return location.protocol === "https:" ? "wss" : "ws";
|
|
@@ -21072,18 +21150,19 @@ var mqtt = (() => {
|
|
|
21072
21150
|
return "ws";
|
|
21073
21151
|
}
|
|
21074
21152
|
function parseAuthOptions(opts) {
|
|
21075
|
-
let matches;
|
|
21076
21153
|
if (opts.auth) {
|
|
21077
|
-
|
|
21078
|
-
if (
|
|
21079
|
-
|
|
21080
|
-
opts.
|
|
21081
|
-
opts.password = password;
|
|
21154
|
+
const separator = opts.auth.indexOf(":");
|
|
21155
|
+
if (separator !== -1) {
|
|
21156
|
+
opts.username = opts.auth.slice(0, separator);
|
|
21157
|
+
opts.password = opts.auth.slice(separator + 1);
|
|
21082
21158
|
} else {
|
|
21083
21159
|
opts.username = opts.auth;
|
|
21084
21160
|
}
|
|
21085
21161
|
}
|
|
21086
21162
|
}
|
|
21163
|
+
function stripProtocolColon(protocol) {
|
|
21164
|
+
return protocol?.replace(/:$/, "").toLowerCase();
|
|
21165
|
+
}
|
|
21087
21166
|
function connect(brokerUrl, opts) {
|
|
21088
21167
|
debug("connecting to an MQTT broker...");
|
|
21089
21168
|
if (typeof brokerUrl === "object" && !opts) {
|
|
@@ -21107,8 +21186,9 @@ var mqtt = (() => {
|
|
|
21107
21186
|
if (!opts.protocol && !isRelativeWebSocketUrl) {
|
|
21108
21187
|
throw new Error("Missing protocol");
|
|
21109
21188
|
}
|
|
21110
|
-
opts.protocol =
|
|
21189
|
+
opts.protocol = opts.protocol || getDefaultWebSocketProtocol();
|
|
21111
21190
|
}
|
|
21191
|
+
opts.protocol = stripProtocolColon(opts.protocol);
|
|
21112
21192
|
opts.unixSocket = opts.unixSocket || opts.protocol?.includes("+unix");
|
|
21113
21193
|
if (opts.unixSocket) {
|
|
21114
21194
|
opts.protocol = opts.protocol.replace("+unix", "");
|
|
@@ -21121,12 +21201,12 @@ var mqtt = (() => {
|
|
|
21121
21201
|
}
|
|
21122
21202
|
if (is_browser_1.default || opts.unixSocket) {
|
|
21123
21203
|
opts.socksProxy = void 0;
|
|
21124
|
-
} else if (opts.socksProxy === void 0 && typeof
|
|
21125
|
-
opts.socksProxy =
|
|
21204
|
+
} else if (opts.socksProxy === void 0 && typeof browser_process_exports !== "undefined") {
|
|
21205
|
+
opts.socksProxy = browser_process_exports.env["MQTTJS_SOCKS_PROXY"];
|
|
21126
21206
|
}
|
|
21127
21207
|
if (opts.cert && opts.key) {
|
|
21128
21208
|
if (opts.protocol) {
|
|
21129
|
-
if (
|
|
21209
|
+
if (!SECURE_PROTOCOLS.includes(opts.protocol)) {
|
|
21130
21210
|
switch (opts.protocol) {
|
|
21131
21211
|
case "mqtt":
|
|
21132
21212
|
opts.protocol = "mqtts";
|
|
@@ -21148,27 +21228,10 @@ var mqtt = (() => {
|
|
|
21148
21228
|
throw new Error("Missing secure protocol key");
|
|
21149
21229
|
}
|
|
21150
21230
|
}
|
|
21151
|
-
|
|
21152
|
-
protocols = {};
|
|
21153
|
-
if (!is_browser_1.default && !opts.forceNativeWebSocket) {
|
|
21154
|
-
protocols.ws = require_ws().streamBuilder;
|
|
21155
|
-
protocols.wss = require_ws().streamBuilder;
|
|
21156
|
-
protocols.mqtt = require_tcp().default;
|
|
21157
|
-
protocols.tcp = require_tcp().default;
|
|
21158
|
-
protocols.ssl = require_tls().default;
|
|
21159
|
-
protocols.tls = protocols.ssl;
|
|
21160
|
-
protocols.mqtts = require_tls().default;
|
|
21161
|
-
} else {
|
|
21162
|
-
protocols.ws = require_ws().browserStreamBuilder;
|
|
21163
|
-
protocols.wss = require_ws().browserStreamBuilder;
|
|
21164
|
-
protocols.wx = require_wx().default;
|
|
21165
|
-
protocols.wxs = require_wx().default;
|
|
21166
|
-
protocols.ali = require_ali().default;
|
|
21167
|
-
protocols.alis = require_ali().default;
|
|
21168
|
-
}
|
|
21169
|
-
}
|
|
21231
|
+
const protocols = is_browser_1.default || opts.forceNativeWebSocket ? loadBrowserProtocols() : loadNodeProtocols();
|
|
21170
21232
|
if (!protocols[opts.protocol]) {
|
|
21171
|
-
const
|
|
21233
|
+
const requested = opts.protocol;
|
|
21234
|
+
const isSecure = SECURE_PROTOCOLS.includes(requested);
|
|
21172
21235
|
opts.protocol = [
|
|
21173
21236
|
"mqtt",
|
|
21174
21237
|
"mqtts",
|
|
@@ -21178,12 +21241,16 @@ var mqtt = (() => {
|
|
|
21178
21241
|
"wxs",
|
|
21179
21242
|
"ali",
|
|
21180
21243
|
"alis"
|
|
21181
|
-
].filter((key
|
|
21182
|
-
if (isSecure &&
|
|
21244
|
+
].filter((key) => {
|
|
21245
|
+
if (isSecure && !SECURE_PROTOCOLS.includes(key)) {
|
|
21183
21246
|
return false;
|
|
21184
21247
|
}
|
|
21185
21248
|
return typeof protocols[key] === "function";
|
|
21186
21249
|
})[0];
|
|
21250
|
+
if (isSecure && !opts.protocol) {
|
|
21251
|
+
throw new Error(`No secure transport available for protocol "${requested}"`);
|
|
21252
|
+
}
|
|
21253
|
+
debug("no transport for %s, falling back to %s", requested, opts.protocol);
|
|
21187
21254
|
}
|
|
21188
21255
|
if (opts.clean === false && !opts.clientId) {
|
|
21189
21256
|
throw new Error("Missing clientId for unclean clients");
|
|
@@ -21198,7 +21265,7 @@ var mqtt = (() => {
|
|
|
21198
21265
|
}
|
|
21199
21266
|
opts.host = opts.servers[client2._reconnectCount].host;
|
|
21200
21267
|
opts.port = opts.servers[client2._reconnectCount].port;
|
|
21201
|
-
opts.protocol = !opts.servers[client2._reconnectCount].protocol ? opts.defaultProtocol : opts.servers[client2._reconnectCount].protocol;
|
|
21268
|
+
opts.protocol = !opts.servers[client2._reconnectCount].protocol ? opts.defaultProtocol : stripProtocolColon(opts.servers[client2._reconnectCount].protocol);
|
|
21202
21269
|
opts.hostname = opts.host;
|
|
21203
21270
|
client2._reconnectCount++;
|
|
21204
21271
|
}
|