@turquoisebay/mqtt 0.1.14 → 0.1.15
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/CHANGELOG.md +8 -0
- package/README.md +8 -1
- package/dist/src/channel.js +6 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.1.15] - 2026-02-03
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Echo `correlationId` from inbound JSON in outbound replies
|
|
12
|
+
|
|
13
|
+
### Docs
|
|
14
|
+
- Clarify how `senderId` maps to sessions vs `correlationId`
|
|
15
|
+
|
|
8
16
|
## [0.1.14] - 2026-02-03
|
|
9
17
|
|
|
10
18
|
### Fixed
|
package/README.md
CHANGED
|
@@ -60,6 +60,13 @@ openclaw gateway restart
|
|
|
60
60
|
|
|
61
61
|
## Usage
|
|
62
62
|
|
|
63
|
+
### Sessions & correlation IDs (important)
|
|
64
|
+
|
|
65
|
+
- **Sessions are keyed by `senderId`** → OpenClaw uses `mqtt:{senderId}` as the SessionKey, so memory and conversation history are grouped by sender.
|
|
66
|
+
- **`correlationId` is request‑level only** → if you include it in inbound JSON, it’s echoed back in the outbound reply for client-side matching. It does **not** create a new session or change memory.
|
|
67
|
+
|
|
68
|
+
If you want separate conversations, use distinct `senderId`s.
|
|
69
|
+
|
|
63
70
|
### Receiving messages (inbound)
|
|
64
71
|
|
|
65
72
|
Messages published to your `inbound` topic will be processed by OpenClaw.
|
|
@@ -70,7 +77,7 @@ You can send either plain text or JSON (recommended):
|
|
|
70
77
|
mosquitto_pub -t "openclaw/inbound" -m "Alert: Service down on playground"
|
|
71
78
|
|
|
72
79
|
# JSON (recommended)
|
|
73
|
-
mosquitto_pub -t "openclaw/inbound" -m '{"senderId":"pg-cli","text":"hello"}'
|
|
80
|
+
mosquitto_pub -t "openclaw/inbound" -m '{"senderId":"pg-cli","text":"hello","correlationId":"abc-123"}'
|
|
74
81
|
```
|
|
75
82
|
|
|
76
83
|
### Sending messages (outbound)
|
package/dist/src/channel.js
CHANGED
|
@@ -144,6 +144,7 @@ async function handleInboundMessage(opts) {
|
|
|
144
144
|
// Extract message body and sender from payload
|
|
145
145
|
let messageBody;
|
|
146
146
|
let senderId;
|
|
147
|
+
let correlationId;
|
|
147
148
|
if (parsedPayload && typeof parsedPayload === "object") {
|
|
148
149
|
messageBody =
|
|
149
150
|
parsedPayload.message ??
|
|
@@ -159,6 +160,10 @@ async function handleInboundMessage(opts) {
|
|
|
159
160
|
parsedPayload.from ??
|
|
160
161
|
parsedPayload.service ??
|
|
161
162
|
topic.replace(/\//g, "-");
|
|
163
|
+
correlationId =
|
|
164
|
+
parsedPayload.correlationId ??
|
|
165
|
+
parsedPayload.requestId ??
|
|
166
|
+
undefined;
|
|
162
167
|
}
|
|
163
168
|
else {
|
|
164
169
|
messageBody = text;
|
|
@@ -202,6 +207,7 @@ async function handleInboundMessage(opts) {
|
|
|
202
207
|
text: payload.text,
|
|
203
208
|
kind: info.kind,
|
|
204
209
|
ts: Date.now(),
|
|
210
|
+
...(correlationId ? { correlationId } : {}),
|
|
205
211
|
});
|
|
206
212
|
await mqttClient.publish(outboundTopic, outboundPayload, qos);
|
|
207
213
|
log?.info?.(`MQTT: sent reply to ${outboundTopic}`);
|