Implement key MQTT 5 features not available in MQTT 3.1.1: user properties, reason codes, and shared subscriptions

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

Steps

  1. Upgrade broker and clients to MQTT 5 support (e.g., EMQX, HiveMQ, Mosquitto 2.x); verify version negotiation succeeds in the CONNACK — if the broker downgrades to 3.1.1, MQTT 5 features will be silently unavailable
  2. Use User Properties in PUBLISH packets to carry metadata (device type, firmware version, geographic region) as key-value pairs without embedding them in the payload; brokers forward user properties transparently to subscribers
  3. Read Reason Codes on CONNACK, SUBACK, PUBACK, and DISCONNECT to get specific failure reasons (e.g., reason code 0x97 = Quota Exceeded, 0x87 = Not Authorized) instead of the opaque failure booleans of MQTT 3.1.1
  4. Use Shared Subscriptions ($share/<group>/<topic>) to distribute messages across multiple consumer instances for horizontal scaling; the broker delivers each message to exactly one member of the share group in round-robin or random fashion
  5. Set Message Expiry Interval on QoS 1/2 messages to discard stale commands; set Session Expiry Interval in CONNECT to control how long the broker retains session state after disconnect — use 0 for clean sessions or a nonzero value for persistent sessions
  6. Use the Will Delay Interval in MQTT 5 LWT to defer publishing the will message; set it longer than the expected reconnection window so transient network glitches do not trigger false offline alerts

Known gotchas

Related routes

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
Use MQTT 5 shared subscriptions to load-balance messages across a consumer group of subscribers
docs.hivemq.com · 6 steps · unrated
Implement an MQTT 5 request/response pattern using the Response Topic and Correlation Data properties
docs.oasis-open.org · 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