MQTT GUIDE
3 min readMQTT Subscription Options and Identifiers
Subscription options are per-subscription settings a client sends in the SUBSCRIBE packet that control how the broker delivers matching messages — the maximum QoS, and in MQTT 5.0 the No Local, Retain As Published, and Retain Handling flags. MQTT 5.0 also adds an optional Subscription Identifier: a number the client assigns to a subscription that the broker then stamps on every matching message it delivers, so the client can tell which subscription a message matched.
A subscription is more than a topic filter. When a client sends a SUBSCRIBE, it can attach a set of options to each filter that tune how the broker delivers matching messages — and MQTT 5.0 adds an identifier the broker echoes back on every delivery.
How subscription options work
Every entry in a SUBSCRIBE packet pairs a topic filter with an options byte.
The requested maximum QoS has been there since MQTT 3.1.1; MQTT 5.0 adds three more flags. Together they let the subscriber
shape delivery per subscription, not just per connection:
The subscription identifier
MQTT 5.0 also lets a client put a numeric Subscription Identifier on a subscription. The broker remembers
it and stamps it onto every PUBLISH it delivers for that subscription. When a client holds several overlapping
wildcard subscriptions, it can dispatch each incoming message to the right handler by identifier
— instead of re-matching the topic string itself.
Subscription options and identifiers in TBMQ
TBMQ honors all four subscription options for MQTT 5.0 clients — capping delivered QoS, suppressing local echo, preserving the RETAIN flag, and applying the retain-handling policy — and it supports subscription identifiers, advertising them as available at connect and echoing the identifier on every matching message. You can inspect and edit these per subscription from the Subscriptions page in the UI, and the MQTT protocol guide lists them among the supported 5.0 features.
Frequently asked questions
What are MQTT subscription options?
Per-subscription settings a client sends inside the SUBSCRIBE packet, one set per topic filter. They are the requested maximum QoS and — new in MQTT 5.0 — the No Local, Retain As Published, and Retain Handling flags. They change how the broker delivers messages that match that subscription.
What is a subscription identifier in MQTT 5.0?
A number a client attaches to a subscription. The broker stores it and stamps it onto every PUBLISH it delivers for that subscription, so a client holding several overlapping subscriptions can tell which one a message matched — without re-matching the topic itself.
What does the Retain Handling option do?
It controls whether the broker sends retained messages at subscribe time: 0 always sends them, 1 sends them only if the subscription did not already exist, and 2 never sends them. It stops a client re-receiving retained state on every reconnect.
What is the No Local option for?
With No Local set, the broker will not send a message back to the same connection that published it. It prevents feedback loops when a client both publishes to and subscribes to the same topic — common in bridge and mesh setups.
Are subscription options and identifiers available in MQTT 3.1.1?
Only partly. MQTT 3.1.1 carries a requested maximum QoS per subscription, but No Local, Retain As Published, Retain Handling, and the subscription identifier are all MQTT 5.0 additions.
Run it yourself
TBMQ is a free, open-source MQTT broker built to scale. Spin it up in minutes or try the live demo — no install required.