MQTTClient_message(3)

πŸ’– MQTTClient_message πŸ’–

okay bestie, welcome to the MQTTClient_message page β€” this is a manual from the Library Functions Manual and it's literally the little struct that holds a whole MQTT message's payload + vibes. let's get into it ✨


✨ SYNOPSIS ✨

#include <MQTTClient.h>

πŸŽ€ Data Fields πŸŽ€

here's the whole glow-up, field by field:

  • char struct_id [4]
  • int struct_version
  • int payloadlen
  • void * payload
  • int qos
  • int retained
  • int dup
  • int msgid
  • MQTTProperties properties

🌸 Detailed Description 🌸

so, this is a structure representing the payload and attributes of an MQTT message. that's the whole job. it's giving "everything you need to know about this message except the topic" πŸ’…

and no, the message topic is not part of this structure, no cap. if you want the topic you gotta go hang out with these besties instead:

  • MQTTClient_publishMessage()
  • MQTTClient_publish()
  • MQTTClient_receive()
  • MQTTClient_freeMessage()
  • MQTTClient_messageArrived()

πŸ¦‹ Field Documentation πŸ¦‹

char struct_id[4]

the eyecatcher for this structure πŸ‘€ must be MQTM. like, that's the vibe check, and if it's not MQTM it didn't pass. periodt.

int struct_version

the version number of this structure. Must be 0 or 1. a 0 indicates no message properties 🫢

int payloadlen

the length of the MQTT message payload, in bytes. just the count, bestie, not the actual stuff.

void* payload

a pointer to the payload of the MQTT message. there it is. the goods. ✨

int qos

the quality of service (QoS) assigned to the message. there are three levels of QoS:

  • QoS0 β€” fire and forget πŸ”₯ β€” the message may not be delivered.
  • QoS1 β€” at least once β€” the message will be delivered, but may be delivered more than once in some circumstances 😭 (yes really, keep that in mind).
  • QoS2 β€” once and one only β€” the message will be delivered exactly once. iconic. no notes. πŸ‘‘

int retained

the retained flag serves two purposes depending on whether the message it is associated with is being published or received. okay so watch closely:

  • retained = true β€” for messages being published, a true setting indicates that the MQTT server should retain a copy of the message. The message will then be transmitted to new subscribers to a topic that matches the message topic. For subscribers registering a new subscription, the flag being true indicates that the received message is not a new one, but one that has been retained by the MQTT server.
  • retained = false β€” for publishers, this indicates that this message should not be retained by the MQTT server. For subscribers, a false setting indicates this is a normal message, received as a result of it being published to the server.

int dup

the dup flag indicates whether or not this message is a duplicate. ⚠️ it is only meaningful when receiving QoS1 messages. when true, the client application should take appropriate action to deal with the duplicate message. so like, don't sleep on it.

int msgid

the message identifier is normally reserved for internal use by the MQTT client and server. πŸ™ˆ like, it's theirs, not yours. hands off bestie.

MQTTProperties properties

the MQTT V5 properties associated with the message. yes, V5, we love a modern era. πŸ’œ


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for Paho MQTT C Client Library from the source code. so like, nobody hand-wrote this, the robots did it, and honestly? ate. πŸ€–βœ¨


and that's the whole page bestie!! this one came from the <strong>Paho MQTT C Client Library</strong>, dated <strong>Tue Jun 2 2026 00:00:00</strong>, and yeah it's page <strong>MQTTClient_message(3)</strong> β€” section 3, library functions, iykyk. stay slay, go publish something cute πŸŽ€πŸ’–πŸ¦‹

πŸ“¦ where this page comes from