mqtt-plus 1.4.0 → 1.4.2

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.
Files changed (73) hide show
  1. package/AGENTS.md +55 -44
  2. package/CHANGELOG.md +14 -0
  3. package/README.md +4 -3
  4. package/doc/mqtt-plus-api.md +693 -680
  5. package/doc/mqtt-plus-architecture.d2 +139 -0
  6. package/doc/mqtt-plus-architecture.md +10 -0
  7. package/doc/mqtt-plus-architecture.svg +95 -0
  8. package/doc/mqtt-plus-broker-setup.md +9 -3
  9. package/doc/mqtt-plus-comm.md +73 -0
  10. package/doc/mqtt-plus-internals.md +3 -3
  11. package/dst-stage1/mqtt-plus-base.d.ts +3 -2
  12. package/dst-stage1/mqtt-plus-base.js +53 -22
  13. package/dst-stage1/mqtt-plus-event.d.ts +0 -2
  14. package/dst-stage1/mqtt-plus-event.js +6 -26
  15. package/dst-stage1/mqtt-plus-meta.d.ts +2 -2
  16. package/dst-stage1/mqtt-plus-meta.js +2 -2
  17. package/dst-stage1/mqtt-plus-msg.d.ts +2 -0
  18. package/dst-stage1/mqtt-plus-msg.js +17 -0
  19. package/dst-stage1/mqtt-plus-service.d.ts +0 -5
  20. package/dst-stage1/mqtt-plus-service.js +12 -48
  21. package/dst-stage1/mqtt-plus-sink.d.ts +0 -10
  22. package/dst-stage1/mqtt-plus-sink.js +25 -92
  23. package/dst-stage1/mqtt-plus-source.d.ts +0 -10
  24. package/dst-stage1/mqtt-plus-source.js +23 -88
  25. package/dst-stage1/mqtt-plus-subscription.d.ts +20 -0
  26. package/dst-stage1/mqtt-plus-subscription.js +126 -0
  27. package/dst-stage1/mqtt-plus-timer.d.ts +8 -0
  28. package/dst-stage1/mqtt-plus-timer.js +57 -0
  29. package/dst-stage1/mqtt-plus-topic.d.ts +20 -0
  30. package/dst-stage1/mqtt-plus-topic.js +112 -0
  31. package/dst-stage1/mqtt-plus-trace.js +2 -0
  32. package/dst-stage1/mqtt-plus-util.d.ts +0 -13
  33. package/dst-stage1/mqtt-plus-util.js +1 -77
  34. package/dst-stage1/mqtt-plus-version.d.ts +0 -1
  35. package/dst-stage1/mqtt-plus-version.js +0 -6
  36. package/dst-stage1/tsc.tsbuildinfo +1 -1
  37. package/dst-stage2/mqtt-plus.cjs.js +242 -292
  38. package/dst-stage2/mqtt-plus.esm.js +240 -290
  39. package/dst-stage2/mqtt-plus.umd.js +12 -12
  40. package/etc/knip.jsonc +1 -1
  41. package/etc/stx.conf +6 -4
  42. package/package.json +1 -1
  43. package/src/mqtt-plus-base.ts +56 -26
  44. package/src/mqtt-plus-event.ts +8 -24
  45. package/src/mqtt-plus-meta.ts +3 -3
  46. package/src/mqtt-plus-msg.ts +28 -0
  47. package/src/mqtt-plus-service.ts +12 -50
  48. package/src/mqtt-plus-sink.ts +32 -105
  49. package/src/mqtt-plus-source.ts +29 -99
  50. package/src/mqtt-plus-subscription.ts +141 -0
  51. package/src/mqtt-plus-timer.ts +61 -0
  52. package/src/mqtt-plus-trace.ts +4 -0
  53. package/src/mqtt-plus-util.ts +1 -81
  54. package/src/mqtt-plus-version.ts +0 -7
  55. package/tst/mqtt-plus-0-fixture.ts +2 -2
  56. package/tst/mqtt-plus-0-mosquitto.ts +5 -0
  57. package/tst/mqtt-plus-1-api.spec.ts +1 -1
  58. package/tst/mqtt-plus-2-event.spec.ts +0 -6
  59. package/tst/mqtt-plus-3-service.spec.ts +3 -7
  60. package/tst/mqtt-plus-4-sink.spec.ts +14 -9
  61. package/tst/mqtt-plus-5-source.spec.ts +11 -5
  62. package/tst/mqtt-plus-6-misc.spec.ts +23 -23
  63. package/tst/tsc.json +1 -1
  64. package/doc/mqtt-plus-communication.md +0 -68
  65. /package/doc/{mqtt-plus-1-event-emission.d2 → mqtt-plus-comm-event-emission.d2} +0 -0
  66. /package/doc/{mqtt-plus-1-event-emission.svg → mqtt-plus-comm-event-emission.svg} +0 -0
  67. /package/doc/{mqtt-plus-2-service-call.d2 → mqtt-plus-comm-service-call.d2} +0 -0
  68. /package/doc/{mqtt-plus-2-service-call.svg → mqtt-plus-comm-service-call.svg} +0 -0
  69. /package/doc/{mqtt-plus-3-sink-push.d2 → mqtt-plus-comm-sink-push.d2} +0 -0
  70. /package/doc/{mqtt-plus-3-sink-push.svg → mqtt-plus-comm-sink-push.svg} +0 -0
  71. /package/doc/{mqtt-plus-4-source-fetch.d2 → mqtt-plus-comm-source-fetch.d2} +0 -0
  72. /package/doc/{mqtt-plus-4-source-fetch.svg → mqtt-plus-comm-source-fetch.svg} +0 -0
  73. /package/{doc/theme.d2 → etc/d2.theme.d2} +0 -0
@@ -0,0 +1,139 @@
1
+
2
+ classes: {
3
+ entry: {
4
+ style: {
5
+ fill: "#333333"
6
+ stroke: "#111111"
7
+ font-color: "#ffffff"
8
+ bold: true
9
+ }
10
+ }
11
+ api: {
12
+ style: {
13
+ fill: "#ffe0c9"
14
+ stroke: "#cfb098"
15
+ }
16
+ }
17
+ infra: {
18
+ style: {
19
+ fill: "#d0e0ef"
20
+ stroke: "#99ccff"
21
+ }
22
+ }
23
+ base: {
24
+ style: {
25
+ fill: "#f0f0f0"
26
+ stroke: "#c0c0c0"
27
+ }
28
+ }
29
+ }
30
+
31
+ # main entry point
32
+ main: "mqtt-plus" { class: entry }
33
+
34
+ # authentication & API traits
35
+ auth: "mqtt-plus-auth" { class: api }
36
+ event: "mqtt-plus-event" { class: api }
37
+ service: "mqtt-plus-service" { class: api }
38
+ source: "mqtt-plus-source" { class: api }
39
+ sink: "mqtt-plus-sink" { class: api }
40
+
41
+ # configuration & encoding layer
42
+ options: "mqtt-plus-options" { class: infra }
43
+ codec: "mqtt-plus-codec" { class: infra }
44
+ encode: "mqtt-plus-encode" { class: infra }
45
+ msg: "mqtt-plus-msg" { class: infra }
46
+ trace: "mqtt-plus-trace" { class: infra }
47
+ base: "mqtt-plus-base" { class: infra }
48
+ sub: "mqtt-plus-subscription" { class: infra }
49
+ timer: "mqtt-plus-timer" { class: infra }
50
+ meta: "mqtt-plus-meta" { class: infra }
51
+
52
+ # base/utility layer (no local imports)
53
+ api: "mqtt-plus-api" { class: base }
54
+ error: "mqtt-plus-error" { class: base }
55
+ info: "mqtt-plus-info" { class: base }
56
+ util: "mqtt-plus-util" { class: base }
57
+ version: "mqtt-plus-version" { class: base }
58
+
59
+ # options depends on
60
+ options -> api
61
+
62
+ # codec depends on
63
+ codec -> api
64
+ codec -> options
65
+
66
+ # encode depends on
67
+ encode -> api
68
+ encode -> codec
69
+
70
+ # msg depends on
71
+ msg -> api
72
+ msg -> encode
73
+ msg -> version
74
+
75
+ # trace depends on
76
+ trace -> api
77
+ trace -> msg
78
+ trace -> codec
79
+
80
+ # base depends on
81
+ base -> api
82
+ base -> options
83
+ base -> trace
84
+ base -> error
85
+
86
+ # subscription depends on
87
+ sub -> api
88
+ sub -> base
89
+
90
+ # timer depends on
91
+ timer -> api
92
+ timer -> sub
93
+
94
+ # meta depends on
95
+ meta -> api
96
+ meta -> timer
97
+
98
+ # auth depends on
99
+ auth -> api
100
+ auth -> meta
101
+
102
+ # event depends on
103
+ event -> api
104
+ event -> info
105
+ event -> msg
106
+ event -> auth
107
+ event -> error
108
+
109
+ # service depends on
110
+ service -> api
111
+ service -> info
112
+ service -> msg
113
+ service -> event
114
+ service -> auth
115
+ service -> error
116
+
117
+ # source depends on
118
+ source -> api
119
+ source -> info
120
+ source -> msg
121
+ source -> service
122
+ source -> auth
123
+ source -> util
124
+ source -> error
125
+
126
+ # sink depends on
127
+ sink -> api
128
+ sink -> info
129
+ sink -> msg
130
+ sink -> source
131
+ sink -> auth
132
+ sink -> util
133
+ sink -> error
134
+
135
+ # main entry point depends on
136
+ main -> api
137
+ main -> info
138
+ main -> version
139
+ main -> sink
@@ -0,0 +1,10 @@
1
+
2
+ MQTT+ Architecture
3
+ ==================
4
+
5
+ **MQTT+** is composed as a vertical chain of API and infratructure trait
6
+ classes (mixins), each extending the previous. Additionally, some base
7
+ modules complement the functionality.
8
+
9
+ ![Architecture](mqtt-plus-architecture.svg)
10
+
@@ -0,0 +1,95 @@
1
+ <?xml version="1.0" encoding="utf-8"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" data-d2-version="v0.7.0-HEAD" preserveAspectRatio="xMinYMin meet" viewBox="0 0 1820 3308"><svg class="d2-3577688721 d2-svg" width="1820" height="3308" viewBox="11 11 1820 3308"><rect x="11.000000" y="11.000000" width="1820.000000" height="3308.000000" rx="0.000000" fill="#ffffff" class=" fill-N7" stroke-width="0" /><style type="text/css"><![CDATA[
2
+ .d2-3577688721 .text-bold {
3
+ font-family: "d2-3577688721-font-bold";
4
+ }
5
+ @font-face {
6
+ font-family: d2-3577688721-font-bold;
7
+ src: url("data:application/font-woff;base64,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");
8
+ }]]></style><style type="text/css"><![CDATA[.shape {
9
+ shape-rendering: geometricPrecision;
10
+ stroke-linejoin: round;
11
+ }
12
+ .connection {
13
+ stroke-linecap: round;
14
+ stroke-linejoin: round;
15
+ }
16
+ .blend {
17
+ mix-blend-mode: multiply;
18
+ opacity: 0.5;
19
+ }
20
+
21
+ .d2-3577688721 .fill-N1{fill:#303030;}
22
+ .d2-3577688721 .fill-N2{fill:#606060;}
23
+ .d2-3577688721 .fill-N3{fill:#909090;}
24
+ .d2-3577688721 .fill-N4{fill:#c0c0c0;}
25
+ .d2-3577688721 .fill-N5{fill:#e0e0e0;}
26
+ .d2-3577688721 .fill-N6{fill:#f0f0f0;}
27
+ .d2-3577688721 .fill-N7{fill:#ffffff;}
28
+ .d2-3577688721 .fill-B1{fill:#336699;}
29
+ .d2-3577688721 .fill-B2{fill:#6699cc;}
30
+ .d2-3577688721 .fill-B3{fill:#99ccff;}
31
+ .d2-3577688721 .fill-B4{fill:#c0d0ff;}
32
+ .d2-3577688721 .fill-B5{fill:#e0f0ff;}
33
+ .d2-3577688721 .fill-B6{fill:#f0f8ff;}
34
+ .d2-3577688721 .fill-AA2{fill:#cfb098;}
35
+ .d2-3577688721 .fill-AA4{fill:#efd0b8;}
36
+ .d2-3577688721 .fill-AA5{fill:#ffe0c8;}
37
+ .d2-3577688721 .fill-AB4{fill:#efd0b8;}
38
+ .d2-3577688721 .fill-AB5{fill:#ffe0c8;}
39
+ .d2-3577688721 .stroke-N1{stroke:#303030;}
40
+ .d2-3577688721 .stroke-N2{stroke:#606060;}
41
+ .d2-3577688721 .stroke-N3{stroke:#909090;}
42
+ .d2-3577688721 .stroke-N4{stroke:#c0c0c0;}
43
+ .d2-3577688721 .stroke-N5{stroke:#e0e0e0;}
44
+ .d2-3577688721 .stroke-N6{stroke:#f0f0f0;}
45
+ .d2-3577688721 .stroke-N7{stroke:#ffffff;}
46
+ .d2-3577688721 .stroke-B1{stroke:#336699;}
47
+ .d2-3577688721 .stroke-B2{stroke:#6699cc;}
48
+ .d2-3577688721 .stroke-B3{stroke:#99ccff;}
49
+ .d2-3577688721 .stroke-B4{stroke:#c0d0ff;}
50
+ .d2-3577688721 .stroke-B5{stroke:#e0f0ff;}
51
+ .d2-3577688721 .stroke-B6{stroke:#f0f8ff;}
52
+ .d2-3577688721 .stroke-AA2{stroke:#cfb098;}
53
+ .d2-3577688721 .stroke-AA4{stroke:#efd0b8;}
54
+ .d2-3577688721 .stroke-AA5{stroke:#ffe0c8;}
55
+ .d2-3577688721 .stroke-AB4{stroke:#efd0b8;}
56
+ .d2-3577688721 .stroke-AB5{stroke:#ffe0c8;}
57
+ .d2-3577688721 .background-color-N1{background-color:#303030;}
58
+ .d2-3577688721 .background-color-N2{background-color:#606060;}
59
+ .d2-3577688721 .background-color-N3{background-color:#909090;}
60
+ .d2-3577688721 .background-color-N4{background-color:#c0c0c0;}
61
+ .d2-3577688721 .background-color-N5{background-color:#e0e0e0;}
62
+ .d2-3577688721 .background-color-N6{background-color:#f0f0f0;}
63
+ .d2-3577688721 .background-color-N7{background-color:#ffffff;}
64
+ .d2-3577688721 .background-color-B1{background-color:#336699;}
65
+ .d2-3577688721 .background-color-B2{background-color:#6699cc;}
66
+ .d2-3577688721 .background-color-B3{background-color:#99ccff;}
67
+ .d2-3577688721 .background-color-B4{background-color:#c0d0ff;}
68
+ .d2-3577688721 .background-color-B5{background-color:#e0f0ff;}
69
+ .d2-3577688721 .background-color-B6{background-color:#f0f8ff;}
70
+ .d2-3577688721 .background-color-AA2{background-color:#cfb098;}
71
+ .d2-3577688721 .background-color-AA4{background-color:#efd0b8;}
72
+ .d2-3577688721 .background-color-AA5{background-color:#ffe0c8;}
73
+ .d2-3577688721 .background-color-AB4{background-color:#efd0b8;}
74
+ .d2-3577688721 .background-color-AB5{background-color:#ffe0c8;}
75
+ .d2-3577688721 .color-N1{color:#303030;}
76
+ .d2-3577688721 .color-N2{color:#606060;}
77
+ .d2-3577688721 .color-N3{color:#909090;}
78
+ .d2-3577688721 .color-N4{color:#c0c0c0;}
79
+ .d2-3577688721 .color-N5{color:#e0e0e0;}
80
+ .d2-3577688721 .color-N6{color:#f0f0f0;}
81
+ .d2-3577688721 .color-N7{color:#ffffff;}
82
+ .d2-3577688721 .color-B1{color:#336699;}
83
+ .d2-3577688721 .color-B2{color:#6699cc;}
84
+ .d2-3577688721 .color-B3{color:#99ccff;}
85
+ .d2-3577688721 .color-B4{color:#c0d0ff;}
86
+ .d2-3577688721 .color-B5{color:#e0f0ff;}
87
+ .d2-3577688721 .color-B6{color:#f0f8ff;}
88
+ .d2-3577688721 .color-AA2{color:#cfb098;}
89
+ .d2-3577688721 .color-AA4{color:#efd0b8;}
90
+ .d2-3577688721 .color-AA5{color:#ffe0c8;}
91
+ .d2-3577688721 .color-AB4{color:#efd0b8;}
92
+ .d2-3577688721 .color-AB5{color:#ffe0c8;}.appendix text.text{fill:#303030}.md{--color-fg-default:#303030;--color-fg-muted:#606060;--color-fg-subtle:#909090;--color-canvas-default:#ffffff;--color-canvas-subtle:#f0f0f0;--color-border-default:#336699;--color-border-muted:#6699cc;--color-neutral-muted:#f0f0f0;--color-accent-fg:#6699cc;--color-accent-emphasis:#6699cc;--color-attention-subtle:#606060;--color-danger-fg:red;}.sketch-overlay-B1{fill:url(#streaks-dark-d2-3577688721);mix-blend-mode:overlay}.sketch-overlay-B2{fill:url(#streaks-normal-d2-3577688721);mix-blend-mode:color-burn}.sketch-overlay-B3{fill:url(#streaks-normal-d2-3577688721);mix-blend-mode:color-burn}.sketch-overlay-B4{fill:url(#streaks-normal-d2-3577688721);mix-blend-mode:color-burn}.sketch-overlay-B5{fill:url(#streaks-bright-d2-3577688721);mix-blend-mode:darken}.sketch-overlay-B6{fill:url(#streaks-bright-d2-3577688721);mix-blend-mode:darken}.sketch-overlay-AA2{fill:url(#streaks-normal-d2-3577688721);mix-blend-mode:color-burn}.sketch-overlay-AA4{fill:url(#streaks-normal-d2-3577688721);mix-blend-mode:color-burn}.sketch-overlay-AA5{fill:url(#streaks-bright-d2-3577688721);mix-blend-mode:darken}.sketch-overlay-AB4{fill:url(#streaks-normal-d2-3577688721);mix-blend-mode:color-burn}.sketch-overlay-AB5{fill:url(#streaks-bright-d2-3577688721);mix-blend-mode:darken}.sketch-overlay-N1{fill:url(#streaks-darker-d2-3577688721);mix-blend-mode:lighten}.sketch-overlay-N2{fill:url(#streaks-dark-d2-3577688721);mix-blend-mode:overlay}.sketch-overlay-N3{fill:url(#streaks-normal-d2-3577688721);mix-blend-mode:color-burn}.sketch-overlay-N4{fill:url(#streaks-normal-d2-3577688721);mix-blend-mode:color-burn}.sketch-overlay-N5{fill:url(#streaks-normal-d2-3577688721);mix-blend-mode:color-burn}.sketch-overlay-N6{fill:url(#streaks-bright-d2-3577688721);mix-blend-mode:darken}.sketch-overlay-N7{fill:url(#streaks-bright-d2-3577688721);mix-blend-mode:darken}.light-code{display: block}.dark-code{display: none}]]></style><g class="bWFpbg== entry"><g class="shape" ><rect x="469.000000" y="12.000000" width="160.000000" height="66.000000" stroke="#111111" fill="#333333" style="stroke-width:2;" /></g><text x="549.000000" y="50.500000" fill="#ffffff" class="text-bold" style="text-anchor:middle;font-size:16px">mqtt-plus</text></g><g class="YXV0aA== api"><g class="shape" ><rect x="478.000000" y="1292.000000" width="160.000000" height="66.000000" stroke="#cfb098" fill="#ffe0c9" style="stroke-width:2;" /></g><text x="558.000000" y="1330.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-auth</text></g><g class="ZXZlbnQ= api"><g class="shape" ><rect x="1253.000000" y="1046.000000" width="200.000000" height="66.000000" stroke="#cfb098" fill="#ffe0c9" style="stroke-width:2;" /></g><text x="1353.000000" y="1084.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-event</text></g><g class="c2VydmljZQ== api"><g class="shape" ><rect x="894.000000" y="750.000000" width="240.000000" height="66.000000" stroke="#cfb098" fill="#ffe0c9" style="stroke-width:2;" /></g><text x="1014.000000" y="788.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-service</text></g><g class="c291cmNl api"><g class="shape" ><rect x="1042.000000" y="454.000000" width="280.000000" height="66.000000" stroke="#cfb098" fill="#ffe0c9" style="stroke-width:2;" /></g><text x="1182.000000" y="492.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-source</text></g><g class="c2luaw== api"><g class="shape" ><rect x="1044.000000" y="208.000000" width="280.000000" height="66.000000" stroke="#cfb098" fill="#ffe0c9" style="stroke-width:2;" /></g><text x="1184.000000" y="246.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-sink</text></g><g class="b3B0aW9ucw== infra"><g class="shape" ><rect x="796.000000" y="2756.000000" width="174.000000" height="66.000000" stroke="#99ccff" fill="#d0e0ef" style="stroke-width:2;" /></g><text x="883.000000" y="2794.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-options</text></g><g class="Y29kZWM= infra"><g class="shape" ><rect x="1051.000000" y="2610.000000" width="162.000000" height="66.000000" stroke="#99ccff" fill="#d0e0ef" style="stroke-width:2;" /></g><text x="1132.000000" y="2648.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-codec</text></g><g class="ZW5jb2Rl infra"><g class="shape" ><rect x="1121.000000" y="2464.000000" width="171.000000" height="66.000000" stroke="#99ccff" fill="#d0e0ef" style="stroke-width:2;" /></g><text x="1206.500000" y="2502.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-encode</text></g><g class="bXNn infra"><g class="shape" ><rect x="1106.000000" y="2318.000000" width="200.000000" height="66.000000" stroke="#99ccff" fill="#d0e0ef" style="stroke-width:2;" /></g><text x="1206.000000" y="2356.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-msg</text></g><g class="dHJhY2U= infra"><g class="shape" ><rect x="799.000000" y="2122.000000" width="157.000000" height="66.000000" stroke="#99ccff" fill="#d0e0ef" style="stroke-width:2;" /></g><text x="877.500000" y="2160.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-trace</text></g><g class="YmFzZQ== infra"><g class="shape" ><rect x="738.000000" y="1876.000000" width="160.000000" height="66.000000" stroke="#99ccff" fill="#d0e0ef" style="stroke-width:2;" /></g><text x="818.000000" y="1914.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-base</text></g><g class="c3Vi infra"><g class="shape" ><rect x="781.000000" y="1730.000000" width="209.000000" height="66.000000" stroke="#99ccff" fill="#d0e0ef" style="stroke-width:2;" /></g><text x="885.500000" y="1768.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-subscription</text></g><g class="dGltZXI= infra"><g class="shape" ><rect x="647.000000" y="1584.000000" width="160.000000" height="66.000000" stroke="#99ccff" fill="#d0e0ef" style="stroke-width:2;" /></g><text x="727.000000" y="1622.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-timer</text></g><g class="bWV0YQ== infra"><g class="shape" ><rect x="572.000000" y="1438.000000" width="156.000000" height="66.000000" stroke="#99ccff" fill="#d0e0ef" style="stroke-width:2;" /></g><text x="650.000000" y="1476.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-meta</text></g><g class="YXBp base"><g class="shape" ><rect x="382.000000" y="3252.000000" width="600.000000" height="66.000000" stroke="#c0c0c0" fill="#f0f0f0" style="stroke-width:2;" /></g><text x="682.000000" y="3290.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-api</text></g><g class="ZXJyb3I= base"><g class="shape" ><rect x="1253.000000" y="2122.000000" width="200.000000" height="66.000000" stroke="#c0c0c0" fill="#f0f0f0" style="stroke-width:2;" /></g><text x="1353.000000" y="2160.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-error</text></g><g class="aW5mbw== base"><g class="shape" ><rect x="1545.000000" y="1292.000000" width="200.000000" height="66.000000" stroke="#c0c0c0" fill="#f0f0f0" style="stroke-width:2;" /></g><text x="1645.000000" y="1330.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-info</text></g><g class="dXRpbA== base"><g class="shape" ><rect x="115.000000" y="750.000000" width="145.000000" height="66.000000" stroke="#c0c0c0" fill="#f0f0f0" style="stroke-width:2;" /></g><text x="187.500000" y="788.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-util</text></g><g class="dmVyc2lvbg== base"><g class="shape" ><rect x="520.000000" y="2464.000000" width="173.000000" height="66.000000" stroke="#c0c0c0" fill="#f0f0f0" style="stroke-width:2;" /></g><text x="606.500000" y="2502.500000" fill="#303030" class="text-bold fill-N1" style="text-anchor:middle;font-size:16px">mqtt-plus-version</text></g><g class="KG9wdGlvbnMgLSZndDsgYXBpKVswXQ=="><marker id="mk-d2-3577688721-3488378134" markerWidth="10.000000" markerHeight="12.000000" refX="7.000000" refY="6.000000" viewBox="0.000000 0.000000 10.000000 12.000000" orient="auto" markerUnits="userSpaceOnUse"> <polygon points="0.000000,0.000000 10.000000,6.000000 0.000000,12.000000" fill="#336699" class="connection fill-B1" stroke-width="2" /> </marker><path d="M 883.583008 2824.000000 L 883.583008 2952.000000 S 883.583008 2962.000000 873.583008 2962.000000 L 767.726013 2962.000000 S 757.726013 2962.000000 757.726013 2972.000000 L 757.726013 3248.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KGNvZGVjIC0mZ3Q7IGFwaSlbMF0="><path d="M 1159.583008 2678.000000 L 1159.583008 3052.000000 S 1159.583008 3062.000000 1149.583008 3062.000000 L 842.726013 3062.000000 S 832.726013 3062.000000 832.726013 3072.000000 L 832.726013 3248.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KGNvZGVjIC0mZ3Q7IG9wdGlvbnMpWzBd"><path d="M 1105.583008 2678.000000 L 1105.583008 2706.000000 S 1105.583008 2716.000000 1095.583008 2716.000000 L 922.583008 2716.000000 S 912.583008 2716.000000 912.583008 2726.000000 L 912.583008 2752.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KGVuY29kZSAtJmd0OyBhcGkpWzBd"><path d="M 1253.583008 2532.000000 L 1253.583008 3102.000000 S 1253.583008 3112.000000 1243.583008 3112.000000 L 880.226013 3112.000000 S 870.226013 3112.000000 870.226013 3122.000000 L 870.226013 3248.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KGVuY29kZSAtJmd0OyBjb2RlYylbMF0="><path d="M 1159.583008 2532.000000 L 1159.583008 2606.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KG1zZyAtJmd0OyBhcGkpWzBd"><path d="M 1256.583008 2386.000000 L 1256.583008 2414.000000 S 1256.583008 2424.000000 1266.583008 2424.000000 L 1381.083008 2424.000000 S 1391.083008 2424.000000 1391.083008 2434.000000 L 1391.083008 3152.000000 S 1391.083008 3162.000000 1381.083008 3162.000000 L 917.726013 3162.000000 S 907.726013 3162.000000 907.726013 3172.000000 L 907.726013 3248.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KG1zZyAtJmd0OyBlbmNvZGUpWzBd"><path d="M 1206.583008 2386.000000 L 1206.583008 2460.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KG1zZyAtJmd0OyB2ZXJzaW9uKVswXQ=="><path d="M 1156.583008 2386.000000 L 1156.583008 2414.000000 S 1156.583008 2424.000000 1146.583008 2424.000000 L 645.916016 2424.000000 S 635.916016 2424.000000 635.916016 2434.000000 L 635.916016 2460.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHRyYWNlIC0mZ3Q7IGFwaSlbMF0="><path d="M 838.833008 2190.000000 L 838.833008 2218.000000 S 838.833008 2228.000000 828.833008 2228.000000 L 765.583008 2228.000000 S 755.583008 2228.000000 755.583008 2238.000000 L 755.583008 2902.000000 S 755.583008 2912.000000 745.583008 2912.000000 L 730.226013 2912.000000 S 720.226013 2912.000000 720.226013 2922.000000 L 720.226013 3248.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHRyYWNlIC0mZ3Q7IG1zZylbMF0="><path d="M 917.333008 2190.000000 L 917.333008 2218.000000 S 917.333008 2228.000000 927.333008 2228.000000 L 1129.916016 2228.000000 S 1139.916016 2228.000000 1139.916016 2238.000000 L 1139.916016 2314.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHRyYWNlIC0mZ3Q7IGNvZGVjKVswXQ=="><path d="M 878.083008 2190.000000 L 878.083008 2560.000000 S 878.083008 2570.000000 888.083008 2570.000000 L 1095.583008 2570.000000 S 1105.583008 2570.000000 1105.583008 2580.000000 L 1105.583008 2606.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KGJhc2UgLSZndDsgYXBpKVswXQ=="><path d="M 770.333008 1944.000000 L 770.333008 1972.000000 S 770.333008 1982.000000 760.333008 1982.000000 L 743.583008 1982.000000 S 733.583008 1982.000000 733.583008 1992.000000 L 733.583008 2852.000000 S 733.583008 2862.000000 723.583008 2862.000000 L 692.726013 2862.000000 S 682.726013 2862.000000 682.726013 2872.000000 L 682.726013 3248.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KGJhc2UgLSZndDsgb3B0aW9ucylbMF0="><path d="M 802.333008 1944.000000 L 802.333008 2022.000000 S 802.333008 2032.000000 792.333008 2032.000000 L 754.583008 2032.000000 S 744.583008 2032.000000 744.583008 2042.000000 L 744.583008 2706.000000 S 744.583008 2716.000000 754.583008 2716.000000 L 844.583008 2716.000000 S 854.583008 2716.000000 854.583008 2726.000000 L 854.583008 2752.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KGJhc2UgLSZndDsgdHJhY2UpWzBd"><path d="M 834.333008 1944.000000 L 834.333008 2118.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KGJhc2UgLSZndDsgZXJyb3IpWzBd"><path d="M 866.333008 1944.000000 L 866.333008 2022.000000 S 866.333008 2032.000000 876.333008 2032.000000 L 1276.891968 2032.000000 S 1286.891968 2032.000000 1286.891968 2042.000000 L 1286.891968 2118.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHN1YiAtJmd0OyBhcGkpWzBd"><path d="M 920.416016 1798.000000 L 920.416016 1826.000000 S 920.416016 1836.000000 930.416016 1836.000000 L 1000.583008 1836.000000 S 1010.583008 1836.000000 1010.583008 1846.000000 L 1010.583008 3002.000000 S 1010.583008 3012.000000 1000.583008 3012.000000 L 805.226013 3012.000000 S 795.226013 3012.000000 795.226013 3022.000000 L 795.226013 3248.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHN1YiAtJmd0OyBiYXNlKVswXQ=="><path d="M 818.333008 1798.000000 L 818.333008 1872.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHRpbWVyIC0mZ3Q7IGFwaSlbMF0="><path d="M 700.999023 1652.000000 L 700.999023 1680.000000 S 700.999023 1690.000000 690.999023 1690.000000 L 489.583008 1690.000000 S 479.583008 1690.000000 479.583008 1700.000000 L 479.583008 2852.000000 S 479.583008 2862.000000 489.583008 2862.000000 L 635.226013 2862.000000 S 645.226013 2862.000000 645.226013 2872.000000 L 645.226013 3248.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHRpbWVyIC0mZ3Q7IHN1YilbMF0="><path d="M 754.333008 1652.000000 L 754.333008 1680.000000 S 754.333008 1690.000000 764.333008 1690.000000 L 875.583008 1690.000000 S 885.583008 1690.000000 885.583008 1700.000000 L 885.583008 1726.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KG1ldGEgLSZndDsgYXBpKVswXQ=="><path d="M 624.726013 1506.000000 L 624.726013 1534.000000 S 624.726013 1544.000000 614.726013 1544.000000 L 436.915985 1544.000000 S 426.915985 1544.000000 426.915985 1554.000000 L 426.915985 2902.000000 S 426.915985 2912.000000 436.915985 2912.000000 L 597.726013 2912.000000 S 607.726013 2912.000000 607.726013 2922.000000 L 607.726013 3248.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KG1ldGEgLSZndDsgdGltZXIpWzBd"><path d="M 676.726013 1506.000000 L 676.726013 1580.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KGF1dGggLSZndDsgYXBpKVswXQ=="><path d="M 531.726013 1360.000000 L 531.726013 1388.000000 S 531.726013 1398.000000 521.726013 1398.000000 L 384.915985 1398.000000 S 374.915985 1398.000000 374.915985 1408.000000 L 374.915985 2952.000000 S 374.915985 2962.000000 384.915985 2962.000000 L 560.226013 2962.000000 S 570.226013 2962.000000 570.226013 2972.000000 L 570.226013 3248.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KGF1dGggLSZndDsgbWV0YSlbMF0="><path d="M 585.059021 1360.000000 L 585.059021 1434.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KGV2ZW50IC0mZ3Q7IGFwaSlbMF0="><path d="M 1386.891968 1114.000000 L 1386.891968 1242.000000 S 1386.891968 1252.000000 1396.891968 1252.000000 L 1483.558960 1252.000000 S 1493.558960 1252.000000 1493.558960 1262.000000 L 1493.558960 3202.000000 S 1493.558960 3212.000000 1483.558960 3212.000000 L 955.226013 3212.000000 S 945.226013 3212.000000 945.226013 3222.000000 L 945.226013 3248.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KGV2ZW50IC0mZ3Q7IGluZm8pWzBd"><path d="M 1420.225952 1114.000000 L 1420.225952 1192.000000 S 1420.225952 1202.000000 1430.225952 1202.000000 L 1568.891968 1202.000000 S 1578.891968 1202.000000 1578.891968 1212.000000 L 1578.891968 1288.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KGV2ZW50IC0mZ3Q7IG1zZylbMF0="><path d="M 1320.225952 1114.000000 L 1320.225952 1192.000000 S 1320.225952 1202.000000 1310.225952 1202.000000 L 1222.558960 1202.000000 S 1212.558960 1202.000000 1212.558960 1212.000000 L 1212.558960 2314.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KGV2ZW50IC0mZ3Q7IGF1dGgpWzBd"><path d="M 1286.891968 1114.000000 L 1286.891968 1142.000000 S 1286.891968 1152.000000 1276.891968 1152.000000 L 616.392029 1152.000000 S 606.392029 1152.000000 606.392029 1162.000000 L 606.392029 1288.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KGV2ZW50IC0mZ3Q7IGVycm9yKVswXQ=="><path d="M 1353.558960 1114.000000 L 1353.558960 2118.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNlcnZpY2UgLSZndDsgYXBpKVswXQ=="><path d="M 929.213989 818.000000 L 929.213989 846.000000 S 929.213989 856.000000 919.213989 856.000000 L 332.250000 856.000000 S 322.250000 856.000000 322.250000 866.000000 L 322.250000 3002.000000 S 322.250000 3012.000000 332.250000 3012.000000 L 522.726013 3012.000000 S 532.726013 3012.000000 532.726013 3022.000000 L 532.726013 3248.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNlcnZpY2UgLSZndDsgaW5mbylbMF0="><path d="M 1100.641968 818.000000 L 1100.641968 846.000000 S 1100.641968 856.000000 1110.641968 856.000000 L 1602.225952 856.000000 S 1612.225952 856.000000 1612.225952 866.000000 L 1612.225952 1288.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNlcnZpY2UgLSZndDsgbXNnKVswXQ=="><path d="M 997.784973 818.000000 L 997.784973 996.000000 S 997.784973 1006.000000 1007.784973 1006.000000 L 1163.250000 1006.000000 S 1173.250000 1006.000000 1173.250000 1016.000000 L 1173.250000 2314.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNlcnZpY2UgLSZndDsgZXZlbnQpWzBd"><path d="M 1066.357056 818.000000 L 1066.357056 896.000000 S 1066.357056 906.000000 1076.357056 906.000000 L 1343.558960 906.000000 S 1353.558960 906.000000 1353.558960 916.000000 L 1353.558960 1042.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNlcnZpY2UgLSZndDsgYXV0aClbMF0="><path d="M 963.500000 818.000000 L 963.500000 896.000000 S 963.500000 906.000000 953.500000 906.000000 L 584.392029 906.000000 S 574.392029 906.000000 574.392029 916.000000 L 574.392029 1288.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNlcnZpY2UgLSZndDsgZXJyb3IpWzBd"><path d="M 1032.071045 818.000000 L 1032.071045 946.000000 S 1032.071045 956.000000 1042.071045 956.000000 L 1191.558960 956.000000 S 1201.558960 956.000000 1201.558960 966.000000 L 1201.558960 1972.000000 S 1201.558960 1982.000000 1211.558960 1982.000000 L 1310.225952 1982.000000 S 1320.225952 1982.000000 1320.225952 1992.000000 L 1320.225952 2118.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNvdXJjZSAtJmd0OyBhcGkpWzBd"><path d="M 1112.927979 522.000000 L 1112.927979 600.000000 S 1112.927979 610.000000 1102.927979 610.000000 L 310.250000 610.000000 S 300.250000 610.000000 300.250000 620.000000 L 300.250000 3052.000000 S 300.250000 3062.000000 310.250000 3062.000000 L 485.226013 3062.000000 S 495.226013 3062.000000 495.226013 3072.000000 L 495.226013 3248.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNvdXJjZSAtJmd0OyBpbmZvKVswXQ=="><path d="M 1252.927979 522.000000 L 1252.927979 600.000000 S 1252.927979 610.000000 1262.927979 610.000000 L 1635.558960 610.000000 S 1645.558960 610.000000 1645.558960 620.000000 L 1645.558960 1288.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNvdXJjZSAtJmd0OyBtc2cpWzBd"><path d="M 1287.927979 522.000000 L 1287.927979 550.000000 S 1287.927979 560.000000 1297.927979 560.000000 L 1775.558960 560.000000 S 1785.558960 560.000000 1785.558960 570.000000 L 1785.558960 2218.000000 S 1785.558960 2228.000000 1775.558960 2228.000000 L 1249.916016 2228.000000 S 1239.916016 2228.000000 1239.916016 2238.000000 L 1239.916016 2314.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNvdXJjZSAtJmd0OyBzZXJ2aWNlKVswXQ=="><path d="M 1182.927979 522.000000 L 1182.927979 700.000000 S 1182.927979 710.000000 1172.927979 710.000000 L 1024.927979 710.000000 S 1014.927979 710.000000 1014.927979 720.000000 L 1014.927979 746.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNvdXJjZSAtJmd0OyBhdXRoKVswXQ=="><path d="M 1147.927979 522.000000 L 1147.927979 650.000000 S 1147.927979 660.000000 1137.927979 660.000000 L 321.250000 660.000000 S 311.250000 660.000000 311.250000 670.000000 L 311.250000 1142.000000 S 311.250000 1152.000000 321.250000 1152.000000 L 532.392029 1152.000000 S 542.392029 1152.000000 542.392029 1162.000000 L 542.392029 1288.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNvdXJjZSAtJmd0OyB1dGlsKVswXQ=="><path d="M 1077.927979 522.000000 L 1077.927979 550.000000 S 1077.927979 560.000000 1067.927979 560.000000 L 221.916000 560.000000 S 211.916000 560.000000 211.916000 570.000000 L 211.916000 746.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNvdXJjZSAtJmd0OyBlcnJvcilbMF0="><path d="M 1217.927979 522.000000 L 1217.927979 650.000000 S 1217.927979 660.000000 1227.927979 660.000000 L 1494.558960 660.000000 S 1504.558960 660.000000 1504.558960 670.000000 L 1504.558960 1972.000000 S 1504.558960 1982.000000 1494.558960 1982.000000 L 1396.891968 1982.000000 S 1386.891968 1982.000000 1386.891968 1992.000000 L 1386.891968 2118.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNpbmsgLSZndDsgYXBpKVswXQ=="><path d="M 1079.416016 276.000000 L 1079.416016 304.000000 S 1079.416016 314.000000 1069.416016 314.000000 L 62.250000 314.000000 S 52.250000 314.000000 52.250000 324.000000 L 52.250000 3102.000000 S 52.250000 3112.000000 62.250000 3112.000000 L 447.726013 3112.000000 S 457.726013 3112.000000 457.726013 3122.000000 L 457.726013 3248.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNpbmsgLSZndDsgaW5mbylbMF0="><path d="M 1219.416016 276.000000 L 1219.416016 404.000000 S 1219.416016 414.000000 1229.416016 414.000000 L 1786.558960 414.000000 S 1796.558960 414.000000 1796.558960 424.000000 L 1796.558960 1142.000000 S 1796.558960 1152.000000 1786.558960 1152.000000 L 1688.891968 1152.000000 S 1678.891968 1152.000000 1678.891968 1162.000000 L 1678.891968 1288.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNpbmsgLSZndDsgbXNnKVswXQ=="><path d="M 1289.416016 276.000000 L 1289.416016 304.000000 S 1289.416016 314.000000 1299.416016 314.000000 L 1808.558960 314.000000 S 1818.558960 314.000000 1818.558960 324.000000 L 1818.558960 2268.000000 S 1818.558960 2278.000000 1808.558960 2278.000000 L 1283.250000 2278.000000 S 1273.250000 2278.000000 1273.250000 2288.000000 L 1273.250000 2314.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNpbmsgLSZndDsgc291cmNlKVswXQ=="><path d="M 1182.927979 276.000000 L 1182.927979 450.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNpbmsgLSZndDsgYXV0aClbMF0="><path d="M 1149.416016 276.000000 L 1149.416016 404.000000 S 1149.416016 414.000000 1139.416016 414.000000 L 84.250000 414.000000 S 74.250000 414.000000 74.250000 424.000000 L 74.250000 1192.000000 S 74.250000 1202.000000 84.250000 1202.000000 L 500.391998 1202.000000 S 510.391998 1202.000000 510.391998 1212.000000 L 510.391998 1288.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNpbmsgLSZndDsgdXRpbClbMF0="><path d="M 1114.416016 276.000000 L 1114.416016 354.000000 S 1114.416016 364.000000 1104.416016 364.000000 L 73.250000 364.000000 S 63.250000 364.000000 63.250000 374.000000 L 63.250000 550.000000 S 63.250000 560.000000 73.250000 560.000000 L 153.582993 560.000000 S 163.582993 560.000000 163.582993 570.000000 L 163.582993 746.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KHNpbmsgLSZndDsgZXJyb3IpWzBd"><path d="M 1254.416016 276.000000 L 1254.416016 354.000000 S 1254.416016 364.000000 1264.416016 364.000000 L 1797.558960 364.000000 S 1807.558960 364.000000 1807.558960 374.000000 L 1807.558960 2022.000000 S 1807.558960 2032.000000 1797.558960 2032.000000 L 1430.225952 2032.000000 S 1420.225952 2032.000000 1420.225952 2042.000000 L 1420.225952 2118.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KG1haW4gLSZndDsgYXBpKVswXQ=="><path d="M 501.178009 80.000000 L 501.178009 108.000000 S 501.178009 118.000000 491.178009 118.000000 L 22.000000 118.000000 S 12.000000 118.000000 12.000000 128.000000 L 12.000000 3152.000000 S 12.000000 3162.000000 22.000000 3162.000000 L 410.226013 3162.000000 S 420.226013 3162.000000 420.226013 3172.000000 L 420.226013 3248.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KG1haW4gLSZndDsgaW5mbylbMF0="><path d="M 597.177979 80.000000 L 597.177979 108.000000 S 597.177979 118.000000 607.177979 118.000000 L 1819.558960 118.000000 S 1829.558960 118.000000 1829.558960 128.000000 L 1829.558960 1192.000000 S 1829.558960 1202.000000 1819.558960 1202.000000 L 1722.225952 1202.000000 S 1712.225952 1202.000000 1712.225952 1212.000000 L 1712.225952 1288.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KG1haW4gLSZndDsgdmVyc2lvbilbMF0="><path d="M 533.177979 80.000000 L 533.177979 158.000000 S 533.177979 168.000000 523.177979 168.000000 L 43.500000 168.000000 S 33.500000 168.000000 33.500000 178.000000 L 33.500000 2414.000000 S 33.500000 2424.000000 43.500000 2424.000000 L 568.250000 2424.000000 S 578.250000 2424.000000 578.250000 2434.000000 L 578.250000 2460.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><g class="KG1haW4gLSZndDsgc2luaylbMF0="><path d="M 565.177979 80.000000 L 565.177979 158.000000 S 565.177979 168.000000 575.177979 168.000000 L 1174.416016 168.000000 S 1184.416016 168.000000 1184.416016 178.000000 L 1184.416016 204.000000" stroke="#336699" fill="none" class="connection stroke-B1" style="stroke-width:2;" marker-end="url(#mk-d2-3577688721-3488378134)" mask="url(#d2-3577688721)" /></g><mask id="d2-3577688721" maskUnits="userSpaceOnUse" x="11" y="11" width="1820" height="3308">
93
+ <rect x="11" y="11" width="1820" height="3308" fill="white"></rect>
94
+
95
+ </mask></svg></svg>
@@ -1,6 +1,6 @@
1
1
 
2
- Broker Setup
3
- ------------
2
+ MQTT+ Broker Setup
3
+ ------------------
4
4
 
5
5
  **MQTT+** can be used with an arbitrary MQTT broker. One popular
6
6
  MQTT broker is [Mosquitto](https://mosquitto.org/).
@@ -36,7 +36,7 @@ pattern write $SYS/broker/connection/%c/state
36
36
  topic read example/#
37
37
  topic write example/#
38
38
 
39
- # ==== server/autenticated ACL ====
39
+ # ==== server/authenticated ACL ====
40
40
 
41
41
  user example
42
42
 
@@ -76,6 +76,7 @@ pattern write example/client/+/service-call-response/%c
76
76
  topic write example/server/+/source-fetch-request/+
77
77
  pattern read example/server/+/source-fetch-response/%c
78
78
  pattern read example/server/+/source-fetch-chunk/%c
79
+ topic write example/server/+/source-fetch-credit/+
79
80
 
80
81
  topic read example/client/+/source-fetch-request/any
81
82
  pattern read example/client/+/source-fetch-request/%c
@@ -92,6 +93,7 @@ topic read example/client/+/sink-push-request/any
92
93
  pattern read example/client/+/sink-push-request/%c
93
94
  pattern write example/client/+/sink-push-response/%c
94
95
  pattern read example/client/+/sink-push-chunk/%c
96
+ pattern read example/client/+/sink-push-credit/%c
95
97
 
96
98
  # ==== server/authenticated ACL ====
97
99
 
@@ -125,6 +127,8 @@ pattern read example/server/+/source-fetch-request/%c
125
127
  pattern read $share/server/example/server/+/source-fetch-request/%c
126
128
  topic write example/server/+/source-fetch-response/+
127
129
  topic write example/server/+/source-fetch-chunk/+
130
+ pattern read example/server/+/source-fetch-credit/%c
131
+ pattern read $share/server/example/server/+/source-fetch-credit/%c
128
132
 
129
133
  topic write example/client/+/source-fetch-request/+
130
134
  pattern read example/client/+/source-fetch-response/%c
@@ -139,6 +143,7 @@ pattern read $share/default/example/server/+/sink-push-request/%c
139
143
  topic write example/server/+/sink-push-response/+
140
144
  pattern read example/server/+/sink-push-chunk/%c
141
145
  pattern read $share/default/example/server/+/sink-push-chunk/%c
146
+ topic write example/client/+/sink-push-credit/+
142
147
 
143
148
  topic write example/client/+/sink-push-request/+
144
149
  pattern read example/client/+/sink-push-response/%c
@@ -150,3 +155,4 @@ topic write example/client/+/sink-push-chunk/+
150
155
  ```
151
156
  example:$6$awYNe6oCAi+xlvo5$mWIUqyy4I0O3nJ99lP1mkRVqsDGymF8en5NChQQxf7KrVJLUp1SzrrVDe94wWWJa3JGIbOXD9wfFGZdi948e6A==
152
157
  ```
158
+
@@ -0,0 +1,73 @@
1
+
2
+ MQTT+ Communication Patterns
3
+ ============================
4
+
5
+ Event Emission
6
+ --------------
7
+
8
+ Event Emission is a *uni-directional* communication pattern.
9
+ An Event is the combination of an event name and optionally zero or more parameters.
10
+ You *register* for events.
11
+ When an event is *emitted*, either a single particular receiver (in
12
+ case of a directed event emission) or *all* receivers are called and
13
+ receive the parameters as extra information.
14
+
15
+ > In contrast to the regular MQTT message publish/subscribe, this
16
+ > pattern allows to direct the event to particular receivers,
17
+ > provides optional information about the sender and receiver to
18
+ > receivers, supports authentication and meta-data, etc.
19
+
20
+ ![Event Emission](mqtt-plus-comm-event-emission.svg)
21
+
22
+ Service Call
23
+ ------------
24
+
25
+ Service Call is a *bi-directional* communication pattern.
26
+ A Service is the combination of a service name and optionally zero or more parameters.
27
+ You *register* a service.
28
+ When a service is *called*, a single particular receiver (in case
29
+ of a directed service call) or *one* arbitrary receiver is called and
30
+ receives the arguments as the request. The receiver then has to
31
+ provide the service response.
32
+
33
+ > In contrast to the regular uni-directional MQTT message
34
+ > publish/subscribe communication, this allows a bi-directional [Remote
35
+ > Procedure Call](https://en.wikipedia.org/wiki/Remote_procedure_call)
36
+ > (RPC) style communication, supports authentication and meta-data, etc.
37
+
38
+ ![Service Call](mqtt-plus-comm-service-call.svg)
39
+
40
+ Sink Push
41
+ ---------
42
+
43
+ Sink Push is a *bi-directional* communication pattern for pushing data.
44
+ A Sink is the combination of a sink name and optionally zero or more parameters.
45
+ You *register* a *sink* for receiving pushed data chunks.
46
+ When data is *pushed*, a single particular sink (in case of a directed
47
+ sink push) or *one* arbitrary sink is called and receives the data
48
+ chunks as a stream with arguments.
49
+
50
+ > In contrast to the regular MQTT message publish/subscribe, this
51
+ > pattern allows to transfer arbitrary amounts of arbitrary data by
52
+ > chunking the data via a stream. Additionally, it supports authentication
53
+ > and meta-data, etc.
54
+
55
+ ![Sink Push](mqtt-plus-comm-sink-push.svg)
56
+
57
+ Source Fetch
58
+ ------------
59
+
60
+ Source Fetch is a *bi-directional* communication pattern for fetching data.
61
+ A Source is the combination of a source name and optionally zero or more parameters.
62
+ You *register* a *source* for sending data chunks.
63
+ When data is *fetched*, a single particular source (in case of a
64
+ directed source fetch) or *one* arbitrary source is called and sends the
65
+ data chunks as a stream with arguments.
66
+
67
+ > In contrast to the regular MQTT message publish/subscribe, this
68
+ > pattern allows to transfer arbitrary amounts of arbitrary data by
69
+ > chunking the data via a stream. Additionally, it supports
70
+ > authentication and meta-data, etc.
71
+
72
+ ![Source Fetch](mqtt-plus-comm-source-fetch.svg)
73
+
@@ -1,6 +1,6 @@
1
1
 
2
- Internals
3
- ---------
2
+ MQTT+ Internals
3
+ ---------------
4
4
 
5
5
  In the following, we assume that an **MQTT+** instance is created with:
6
6
 
@@ -57,7 +57,7 @@ message to the temporary (client-specific) MQTT topic
57
57
  "type": "service-call-response",
58
58
  "id": "vwLzfQDu2uEeOdOfIlT42",
59
59
  "result": "world:42",
60
- "sender": "2IBMSk0NPnrz1AeTERoea",
60
+ "sender": "7kPQm3xRtYnJw8FvUqE5b",
61
61
  "receiver": "2IBMSk0NPnrz1AeTERoea"
62
62
  }
63
63
  ```
@@ -5,11 +5,12 @@ import { TraceTrait } from "./mqtt-plus-trace";
5
5
  export declare class BaseTrait<T extends APISchema = APISchema> extends TraceTrait<T> {
6
6
  protected mqtt: MqttClient;
7
7
  private _messageHandler;
8
+ protected onRequest: Map<string, (message: any, topicName: string) => void>;
9
+ protected onResponse: Map<string, (message: any, topicName: string) => void>;
8
10
  constructor(mqtt: MqttClient | null, options?: Partial<APIOptions>);
9
- destroy(): void;
11
+ destroy(): Promise<void>;
10
12
  protected _subscribeTopic(topic: string, options?: Partial<IClientSubscribeOptions>): Promise<void>;
11
13
  protected _unsubscribeTopic(topic: string): Promise<void>;
12
14
  protected _publishToTopic(topic: string, message: string | Uint8Array, options?: IClientPublishOptions): Promise<void>;
13
15
  private _onMessage;
14
- protected _dispatchMessage(_topic: string, _parsed: any): Promise<void>;
15
16
  }
@@ -24,11 +24,15 @@
24
24
  /* external requirements */
25
25
  import PLazy from "p-lazy";
26
26
  import { TraceTrait } from "./mqtt-plus-trace";
27
+ import { ensureError } from "./mqtt-plus-error";
27
28
  /* MQTTp Base class with shared infrastructure */
28
29
  export class BaseTrait extends TraceTrait {
29
30
  /* construct API class */
30
31
  constructor(mqtt, options = {}) {
31
32
  super(options);
33
+ /* central message callback registries */
34
+ this.onRequest = new Map();
35
+ this.onResponse = new Map();
32
36
  /* optionally provide a fake proxy for the MQTT client
33
37
  (mainly for using emit({ ..., dry: true }) to just make MQTT "last will") */
34
38
  if (mqtt === null) {
@@ -71,7 +75,7 @@ export class BaseTrait extends TraceTrait {
71
75
  this.mqtt.on("message", this._messageHandler);
72
76
  }
73
77
  /* destroy API class */
74
- destroy() {
78
+ async destroy() {
75
79
  this.log("info", "un-hooking from MQTT client");
76
80
  this.mqtt.off("message", this._messageHandler);
77
81
  }
@@ -140,31 +144,58 @@ export class BaseTrait extends TraceTrait {
140
144
  });
141
145
  }
142
146
  /* handle incoming MQTT message */
143
- _onMessage(topic, message, packet) {
144
- /* try to parse message as payload */
145
- if (typeof message === "string")
146
- this.log("info", `received from MQTT topic "${topic}" (type: string, length: ${message.length} chars)`);
147
+ _onMessage(topic, data, packet) {
148
+ /* parse MQTT topic */
149
+ const topicMatch = this.options.topicMatch(topic);
150
+ if (topicMatch === null)
151
+ return;
152
+ /* parse MQTT data into payload object */
153
+ if (typeof data === "string")
154
+ this.log("info", `received from MQTT topic "${topic}" (type: string, length: ${data.length} chars)`);
147
155
  else
148
- this.log("info", `received from MQTT topic "${topic}" (type: buffer, length: ${message.byteLength} bytes)`);
149
- let parsed;
156
+ this.log("info", `received from MQTT topic "${topic}" (type: buffer, length: ${data.byteLength} bytes)`);
157
+ let payload;
150
158
  try {
151
- const payload = this.codec.decode(message);
152
- parsed = this.msg.parse(payload);
159
+ payload = this.codec.decode(data);
153
160
  }
154
- catch (_err) {
155
- const err = _err instanceof Error
156
- ? new Error(`failed to parse message: ${_err.message}`, { cause: _err })
157
- : new Error("failed to parse message");
158
- this.error(err);
161
+ catch (err) {
162
+ this.error(ensureError(err, "failed to parse message into object"));
159
163
  return;
160
164
  }
161
- this.log("debug", `received from MQTT topic "${topic}"`, { message: parsed });
162
- /* dispatch to trait handlers */
163
- this._dispatchMessage(topic, parsed).catch((err) => {
164
- this.error(err, `dispatching message from MQTT topic "${topic}" failed`);
165
- });
165
+ /* parse payload object into typed MQTT+ message */
166
+ let message;
167
+ try {
168
+ message = this.msg.parse(payload);
169
+ }
170
+ catch (err) {
171
+ this.error(ensureError(err, "failed to parse object into typed message object"));
172
+ return;
173
+ }
174
+ this.log("debug", `received from MQTT topic "${topic}"`, { message });
175
+ /* dispatch MQTT+ message */
176
+ if (this.msg.isRequest(message)) {
177
+ /* dispatch request message */
178
+ const handler = this.onRequest.get(`${topicMatch.operation}:${message.name}`);
179
+ if (handler !== undefined) {
180
+ try {
181
+ handler(message, topicMatch.name);
182
+ }
183
+ catch (err) {
184
+ this.error(ensureError(err, `dispatching request message from MQTT topic "${topic}" failed`));
185
+ }
186
+ }
187
+ }
188
+ else if (this.msg.isResponse(message)) {
189
+ /* dispatch response message */
190
+ const handler = this.onResponse.get(`${topicMatch.operation}:${message.id}`);
191
+ if (handler !== undefined) {
192
+ try {
193
+ handler(message, topicMatch.name);
194
+ }
195
+ catch (err) {
196
+ this.error(ensureError(err, `dispatching response message from MQTT topic "${topic}" failed`));
197
+ }
198
+ }
199
+ }
166
200
  }
167
- /* dispatch parsed message to appropriate handler
168
- (base implementation, to be overridden in sub-traits) */
169
- async _dispatchMessage(_topic, _parsed) { }
170
201
  }
@@ -3,7 +3,6 @@ import type { APISchema, EventKeys, Registration } from "./mqtt-plus-api";
3
3
  import type { WithInfo, InfoEvent } from "./mqtt-plus-info";
4
4
  import { AuthTrait, type AuthOption } from "./mqtt-plus-auth";
5
5
  export declare class EventTrait<T extends APISchema = APISchema> extends AuthTrait<T> {
6
- private events;
7
6
  event<K extends EventKeys<T> & string>(name: K, callback: WithInfo<T[K], InfoEvent>): Promise<Registration>;
8
7
  event<K extends EventKeys<T> & string>(config: {
9
8
  name: K;
@@ -32,5 +31,4 @@ export declare class EventTrait<T extends APISchema = APISchema> extends AuthTra
32
31
  payload: string | Uint8Array;
33
32
  options: IClientPublishOptions;
34
33
  };
35
- protected _dispatchMessage(topic: string, message: any): Promise<void>;
36
34
  }