Prevent MQTT 5.0 message echo in a bridge or shared-state topic using No Local, Retain As Published, and Retain Handling subscription options

domain: iot · 5 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Set the No Local subscription option flag to 1 in the SUBSCRIBE packet's Subscription Options byte so the broker will not forward a client's own published messages back to it
  2. Set the Retain As Published option to 1 if the forwarded PUBLISH must preserve the original publisher's RETAIN flag value, or 0 to force the forwarded RETAIN flag to 0
  3. Choose a Retain Handling value: 0 to send retained messages on every SUBSCRIBE, 1 to send retained messages only if the subscription does not already exist, or 2 to never send retained messages on subscribe
  4. For bridge topics carrying shared state, combine No Local=1 with Retain Handling=1 so a reconnecting bridge does not receive its own retained echo or duplicate retained sends
  5. Confirm broker support for these options, since not all MQTT 5.0 broker implementations honor every subscription option identically

Known gotchas

Related routes

Reduce MQTT 5 publish overhead for a high-frequency sensor topic by using topic aliases instead of repeating the full topic string
docs.oasis-open.org · 5 steps · unrated
Understand RabbitMQ MQTT plugin behavior differences when using MQTT 5.0 instead of 3.1.1, including QoS 2 and shared subscriptions
rabbitmq · 6 steps · unrated
Set up MQTT 5.0 shared subscriptions on EMQX to load-balance messages across a consumer group
emqx · 6 steps · unrated

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans