u8-mqtt 0.3.1 → 0.3.2-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 +2 -2
- package/cjs/index.cjs +33 -9
- package/cjs/index.cjs.map +1 -1
- package/cjs/v4.cjs +33 -9
- package/cjs/v4.cjs.map +1 -1
- package/cjs/v5.cjs +33 -9
- package/cjs/v5.cjs.map +1 -1
- package/code/core.jsy +41 -15
- package/code/{index.mjs → index.js} +1 -1
- package/code/{v4.mjs → v4.js} +1 -1
- package/code/{v5.mjs → v5.js} +1 -1
- package/code/version.js +1 -0
- package/esm/deno/index.js +38 -15
- package/esm/deno/index.js.map +1 -1
- package/esm/deno/v4.js +38 -15
- package/esm/deno/v4.js.map +1 -1
- package/esm/deno/v5.js +38 -15
- package/esm/deno/v5.js.map +1 -1
- package/esm/node/index.js +32 -8
- package/esm/node/index.js.map +1 -1
- package/esm/node/index.mjs +32 -8
- package/esm/node/index.mjs.map +1 -1
- package/esm/node/v4.js +32 -8
- package/esm/node/v4.js.map +1 -1
- package/esm/node/v4.mjs +32 -8
- package/esm/node/v4.mjs.map +1 -1
- package/esm/node/v5.js +32 -8
- package/esm/node/v5.js.map +1 -1
- package/esm/node/v5.mjs +32 -8
- package/esm/node/v5.mjs.map +1 -1
- package/esm/web/index.js +27 -4
- package/esm/web/index.js.map +1 -1
- package/esm/web/index.min.js +1 -1
- package/esm/web/index.min.js.br +0 -0
- package/esm/web/index.min.js.gz +0 -0
- package/esm/web/v4.js +27 -4
- package/esm/web/v4.js.map +1 -1
- package/esm/web/v4.min.js +1 -1
- package/esm/web/v4.min.js.br +0 -0
- package/esm/web/v4.min.js.gz +0 -0
- package/esm/web/v5.js +27 -4
- package/esm/web/v5.js.map +1 -1
- package/esm/web/v5.min.js +1 -1
- package/esm/web/v5.min.js.br +0 -0
- package/esm/web/v5.min.js.gz +0 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -83,8 +83,8 @@ Built for small footprint with ES Modules (ESM) using embedded [u8-mqtt-packet][
|
|
|
83
83
|
|---------:|-----:|----------------|-------------|
|
|
84
84
|
| 187.0KB | 12x | [MQTT.js][] | `curl -sL https://cdn.jsdelivr.net/npm/mqtt@4.0.1/dist/mqtt.min.js \| wc -c`
|
|
85
85
|
| 32.3KB | 2x | [paho][] | `curl -sL https://cdn.jsdelivr.net/npm/paho-mqtt@1.1.0/paho-mqtt.min.js \| wc -c`
|
|
86
|
-
| 19.9KB | 1.3x | [u8-mqtt][] v5 | `cat ./u8-mqtt/esm/web/v5.min.
|
|
87
|
-
| 15.5KB | 1x | [u8-mqtt][] v4 | `cat ./u8-mqtt/esm/web/v4.min.
|
|
86
|
+
| 19.9KB | 1.3x | [u8-mqtt][] v5 | `cat ./u8-mqtt/esm/web/v5.min.js \| wc -c`
|
|
87
|
+
| 15.5KB | 1x | [u8-mqtt][] v4 | `cat ./u8-mqtt/esm/web/v4.min.js \| wc -c`
|
|
88
88
|
|
|
89
89
|
[MQTT.js]: https://github.com/mqttjs/MQTT.js/
|
|
90
90
|
[paho]: https://github.com/eclipse/paho.mqtt.javascript/
|
package/cjs/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var node_net = require('node:net');
|
|
6
|
+
var node_tls = require('node:tls');
|
|
6
7
|
|
|
7
8
|
function encode_varint(n, a=[]) {
|
|
8
9
|
do {
|
|
@@ -873,8 +874,6 @@ function mqtt_pkt_ctx(mqtt_level, opts, pkt_ctx) {
|
|
|
873
874
|
}
|
|
874
875
|
}
|
|
875
876
|
|
|
876
|
-
Object.freeze({ao_done: true});
|
|
877
|
-
|
|
878
877
|
function ao_defer_ctx(as_res = (...args) => args) {
|
|
879
878
|
let y,n,_pset = (a,b) => { y=a, n=b; };
|
|
880
879
|
return p =>(
|
|
@@ -1454,7 +1453,7 @@ class MQTTCore extends MQTTBase {
|
|
|
1454
1453
|
return this}
|
|
1455
1454
|
|
|
1456
1455
|
//log_conn(evt, arg, err_arg) ::
|
|
1457
|
-
//console.info @ '[[u8-mqtt log: %s]]', evt, arg, err_arg
|
|
1456
|
+
// console.info @ '[[u8-mqtt log: %s]]', evt, arg, err_arg
|
|
1458
1457
|
|
|
1459
1458
|
on_live(client, is_reconnect) {
|
|
1460
1459
|
if (is_reconnect) {
|
|
@@ -1496,6 +1495,7 @@ class MQTTCore extends MQTTBase {
|
|
|
1496
1495
|
return this}
|
|
1497
1496
|
|
|
1498
1497
|
|
|
1498
|
+
|
|
1499
1499
|
|
|
1500
1500
|
|
|
1501
1501
|
|
|
@@ -1504,6 +1504,18 @@ class MQTTCore extends MQTTBase {
|
|
|
1504
1504
|
|
|
1505
1505
|
|
|
1506
1506
|
|
|
1507
|
+
|
|
1508
|
+
|
|
1509
|
+
|
|
1510
|
+
|
|
1511
|
+
|
|
1512
|
+
|
|
1513
|
+
|
|
1514
|
+
|
|
1515
|
+
|
|
1516
|
+
|
|
1517
|
+
|
|
1518
|
+
|
|
1507
1519
|
|
|
1508
1520
|
|
|
1509
1521
|
|
|
@@ -1513,13 +1525,25 @@ class MQTTCore extends MQTTBase {
|
|
|
1513
1525
|
|
|
1514
1526
|
|
|
1515
1527
|
|
|
1516
|
-
with_tcp(
|
|
1517
|
-
|
|
1518
|
-
|
|
1528
|
+
with_tcp(...opt) {
|
|
1529
|
+
opt = this._conn_opt(opt);
|
|
1530
|
+
console.log({opt});
|
|
1531
|
+
return this._use_conn (() =>
|
|
1532
|
+
this.with_stream(
|
|
1533
|
+
node_net.connect(opt)) ) }
|
|
1519
1534
|
|
|
1535
|
+
with_tls(...opt) {
|
|
1536
|
+
opt = this._conn_opt(opt);
|
|
1520
1537
|
return this._use_conn (() =>
|
|
1521
1538
|
this.with_stream(
|
|
1522
|
-
|
|
1539
|
+
node_tls.connect(opt)) ) }
|
|
1540
|
+
|
|
1541
|
+
_conn_opt([a0, a1, a2]) {
|
|
1542
|
+
// (port, hostname, options) or (url, options)
|
|
1543
|
+
if (Number.isFinite(a0)) {
|
|
1544
|
+
return {...a2, port: a0, host: a1}}
|
|
1545
|
+
a0 = new URL(a0);
|
|
1546
|
+
return {...a1, port: a0.port, host: a0.hostname}}
|
|
1523
1547
|
|
|
1524
1548
|
|
|
1525
1549
|
with_stream(read_stream, write_stream) {
|
|
@@ -1565,7 +1589,7 @@ class MQTTCore extends MQTTBase {
|
|
|
1565
1589
|
|
|
1566
1590
|
return this} }
|
|
1567
1591
|
|
|
1568
|
-
|
|
1592
|
+
const version = '0.3.2-0';
|
|
1569
1593
|
|
|
1570
1594
|
const MQTTClient_v4 = /* #__PURE__ */
|
|
1571
1595
|
MQTTCore.mqtt_ctx(4, mqtt_opts_v5);
|
|
@@ -1592,7 +1616,7 @@ exports._mqtt_route_remove = _mqtt_route_remove;
|
|
|
1592
1616
|
exports._mqtt_routes_iter = _mqtt_routes_iter;
|
|
1593
1617
|
exports._mqtt_topic_router = _mqtt_topic_router;
|
|
1594
1618
|
exports.ao_defer_v = ao_defer_v;
|
|
1595
|
-
exports
|
|
1619
|
+
exports.default = mqtt_v4;
|
|
1596
1620
|
exports.mqtt_v4 = mqtt_v4;
|
|
1597
1621
|
exports.mqtt_v5 = mqtt_v5;
|
|
1598
1622
|
exports.version = version;
|