Topics & payloads
Topic format
Section titled “Topic format”mqtt/<client_id>/<network>/<asset>/<metric>The mqtt/ prefix is required — NATS’s MQTT support translates topics to internal subjects by
replacing / with ., and permissions are scoped to mqtt.<client_id>.>. A topic starting with
anything else won’t match your credential’s permissions and the publish will be silently dropped
(this is standard MQTT QoS 0 behavior — no error is returned to the client either way).
| Segment | Meaning |
|---|---|
client_id |
Your MQTT username — must match the credential you connected with |
network |
The water network this reading belongs to |
asset |
The sensor/asset identifier (e.g. pump-1) |
metric |
flow, pressure, level, demand, status, setting, chlorine, temperature, or volume |
You may only publish under your own client_id — the connection itself enforces this, so a
misconfigured device can’t accidentally (or intentionally) publish as another client.
Payload
Section titled “Payload”JSON, one reading per message:
{ "time": "2026-06-01T10:00:00Z", "value": 12.5, "unit": "l/s"}| Field | Type | Notes |
|---|---|---|
time |
string, RFC3339 | When the reading was taken |
value |
number | Negative values are valid (e.g. reverse flow, differential pressure) |
unit |
string | Optional for dimensionless metrics like status/setting |
What happens after you publish
Section titled “What happens after you publish”Your message is queued durably and stored exactly as received. Checking that your client is authorized to write to the specific network named in the topic happens as a separate step, before the reading is stored permanently — this keeps the MQTT connection itself focused on authenticating who you are, while network-level authorization is enforced downstream.