MQTTSubscribe_options(3)

πŸ’– MQTTSubscribe_options(3) πŸ’–

okay bestie, so this is a page from the Library Functions Manual and it's all about MQTTSubscribe_options β€” literally the glow-up that MQTT V5 gave us. periodt. ✨


✨ NAME ✨

MQTTSubscribe_options β€” the struct holding all your MQTT V5 subscribe options, no cap 🌸


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <MQTTSubscribeOpts.h>

πŸŽ€ Data Fields πŸŽ€

char struct_id [4]
int struct_version
unsigned char noLocal
unsigned char retainAsPublished
unsigned char retainHandling

πŸ’… Detailed Description πŸ’…

ngl, this is just the MQTT V5 subscribe options β€” everything except QoS, because QoS was already a whole thing before V5 existed. she's the new girl on the block, and she ate. πŸ‘‘


🌈 Field Documentation 🌈

char struct_id[4]

the eyecatcher for this structure, iykyk. it Must be MQSO. like, no other option, bestie. it's the vibe check for your struct. πŸ’€

int struct_version

the version number of this structure. it Must be 0. that's it. that's the whole field. iconic. ⭐

unsigned char noLocal

you want to NOT receive your own publications? set this to 1. 🫢

set it to 0 and you get the original MQTT behaviour β€” all messages matching the subscription are received, including your own lil messages coming home to roost. πŸ™ˆ

unsigned char retainAsPublished

want to keep the retain flag exactly as it was on the original publish message? set to 1. πŸŽ€

if you set 0, it defaults to the original MQTT behaviour, where the retain flag is only set on publications sent by a broker if in response to a subscribe request. lowkey a whole different vibe.

unsigned char retainHandling

okay so this one has three moods, and you gotta pick one:

  1. 0 β€” send retained messages at the time of the subscribe (this is the original MQTT behaviour, the classic) ✨
  2. 1 β€” send retained messages on subscribe only if the subscription is new πŸ‘€
  3. 2 β€” do not send retained messages at all. simply no. not today. πŸ’…

bestie pls remember: struct_id must be MQSO and struct_version must be 0. these aren't suggestions, they're the rules, fr fr. πŸ”₯

πŸ’œ Author πŸ’œ

Generated automatically by Doxygen for the Paho MQTT C Client Library, straight from the source code. not a human, just a lil robot doing its thing. πŸ€–πŸŒΈ


mwah, that's the whole page bestie 🫢 β€” brought to you by the Paho MQTT C Client Library, dated Tue Jun 2 2026 00:00:00, and page number MQTTSubscribe_options(3) because we keep it cutesy and catalogued. bye now, go subscribe to something. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from