MQTTAsync_message(3)
π MQTTAsync_message(3) π
okay bestie, welcome to the Library Functions Manual page for MQTTAsync_message β yes that's the section 3 vibe, we're in the C library pages now, no cap. pull up a chair, grab a strawberry π, and let's talk structs.
β¨ NAME β¨
MQTTAsync_message β the struct that holds a message's payload + all its lil attributes π
πΈ SYNOPSIS πΈ
#include <MQTTAsync.h>
π Data Fields
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. literally the whole message bundle, glowing, iconic.
π¨ IMPORTANT: the message topic is NOT part of this structure. like, the topic is not here, bestie. it lives elsewhere. go look atMQTTAsync_publishMessage(),MQTTAsync_publish(),MQTTAsync_receive(),MQTTAsync_freeMessage()andMQTTAsync_messageArrived()for that. iykyk.
π FIELD DOCUMENTATION π
π char struct_id[4]
The eyecatcher for this structure. must be MQTM. that's it, that's the vibe check. if it's not MQTM, something is Wrongβ’.
π int struct_version
The version number of this structure. Must be 0 or 1. 0 indicates no message properties. so if you want properties (see below π) you need version 1.
π int payloadlen
The length of the MQTT message payload in bytes. just the number, the count, the receipts on how long the payload is. π
π void* payload
A pointer to the payload of the MQTT message. it points. that's its job. π«Ά
π int qos
The quality of service (QoS) assigned to the message. there are three levels of QoS and yes we're listing all of them:
- QoS0 β Fire and forget π₯ the message may not be delivered. no promises. she said what she said.
- QoS1 β At least once β¨ the message will be delivered, but may be delivered more than once in some circumstances. (so, duplicates possible β noted, remember that for
duplater π) - QoS2 β Once and one only π the message will be delivered exactly once. main character guarantee, periodt.
π int retained
The retained flag serves two purposes depending on whether the message it is associated with is being published or received. plot twist: one flag, two jobs.
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.
β οΈ This is an output parameter only. don't write to it, bestie, it won't do anything for you. π
π int msgid
The message identifier is reserved for internal use by the MQTT client and server. It is an output parameter only β writing to it will serve no purpose. It contains the MQTT message id of an incoming publish message. so like, it's giving "look but don't touch" energy. π
π MQTTProperties properties
The MQTT V5 properties associated with the message. fancy, modern, elevated. β
π AUTHOR π
Generated automatically by Doxygen for the Paho Asynchronous MQTT C Client Library from the source code. (doxygen did the typing, i just did the makeup π)
and that's the whole page, babe π Paho Asynchronous MQTT C Client Library, dated Tue Jun 2 2026 00:00:00, page MQTTAsync_message(3) β you're all caught up, go forth and publish slay π
β¨π₯
π¦ where this page comes from
- fedora 44: paho-c-devel 1.3.16-1.fc44 Β· BSD-3-Clause AND EPL-2.0
- fedora 44: paho-c-devel 1.3.16-1.fc44 Β· BSD-3-Clause AND EPL-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms