asyx 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -83,6 +83,34 @@ ASYX_LOG_LEVEL=debug asyx tunnel --http --port 3000 # full verbosity for engine
83
83
  - Structured logs (JSON) are emitted to stdout/stderr; by default, debug is suppressed.
84
84
  - User-facing banners remain visible regardless of log level.
85
85
 
86
+ ## MQTT Connection Mode
87
+
88
+ Control MQTT client ID generation and reconnect behavior with the `ASYX_MQTT_CLIENTID_MODE` environment variable:
89
+
90
+ ```
91
+ # Modes: legacy | unique
92
+ # Default: unique
93
+ ASYX_MQTT_CLIENTID_MODE=unique asyx tunnel --http --port 3000 # unique client IDs, clean sessions (default)
94
+ ASYX_MQTT_CLIENTID_MODE=legacy asyx tunnel --http --port 3000 # persistent client IDs, mqtt.js auto-reconnect
95
+ ```
96
+
97
+ **`unique` mode (default):**
98
+ - Generates a unique client ID for each CLI invocation using ULID suffixes (e.g., `baseClientId_01ABC...XYZ`)
99
+ - Uses clean MQTT sessions (`clean: true`) so AWS IoT doesn't retain session state between reconnects
100
+ - Implements manual reconnect loop with jittered exponential backoff (300ms → 600ms → 1.2s → max 5s)
101
+ - Immediately reconnects on `ECONNRESET` errors
102
+ - Prevents "identifier in use" errors from lingering AWS IoT sessions
103
+
104
+ **`legacy` mode:**
105
+ - Uses persistent client ID from device configuration
106
+ - Uses persistent MQTT sessions (`clean: false`) allowing AWS IoT to retain session state
107
+ - Relies on mqtt.js built-in auto-reconnect behavior
108
+ - Useful for compatibility with older deployments or debugging
109
+
110
+ **When to use each mode:**
111
+ - Use `unique` (default) for production deployments to avoid lingering session issues
112
+ - Use `legacy` only if you need to maintain session state across reconnects or are debugging specific MQTT behavior
113
+
86
114
  ## Heartbeat Behavior
87
115
 
88
116
  The CLI manages heartbeats automatically to keep idle sessions stable without user tuning.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asyx",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Asyx Command Line Interface",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -35,6 +35,8 @@
35
35
  "src/commands/setup.js",
36
36
  "src/commands/sts.js",
37
37
  "src/commands/tunnel.js",
38
+ "src/control-plane/MqttControlPlaneClient.js",
39
+ "src/control-plane/MqttControlPlaneTransport.js",
38
40
  "src/lib/.gitkeep",
39
41
  "src/lib/certs.js",
40
42
  "src/lib/csr.js",
@@ -58,14 +60,17 @@
58
60
  "SECURITY.md"
59
61
  ],
60
62
  "dependencies": {
63
+ "-": "^0.0.1",
61
64
  "@asyx/mqtt-broker-aws": "^0.1.0",
62
65
  "@asyx/mqtt-client": "^0.1.0",
63
66
  "@peculiar/webcrypto": "^1.5.0",
64
67
  "@peculiar/x509": "^1.14.0",
68
+ "asyx": "^0.1.3",
65
69
  "chalk": "^5.3.0",
66
70
  "hw-fingerprint": "^3.2.0",
67
71
  "node-fetch": "^3.3.2",
68
72
  "open": "^9.1.0",
73
+ "ulid": "^2.4.0",
69
74
  "ws": "^8.14.2",
70
75
  "zod": "3.23.8"
71
76
  },