Payload for a net_mqtt_event_received event. More...
#include <mqtt.h>
Data Fields | |
| const char * | topic |
| Topic the message was published to - may be more specific than the net_mqtt_subscribe() filter that matched it, if that filter used a wildcard. More... | |
| const void * | payload |
| Message payload - NULL if payload_len is 0. More... | |
| size_t | payload_len |
| Total payload length in bytes. | |
| bool | retain |
| True if this is a retained message delivered because of the subscription itself rather than a live publish - see net_mqtt_publish()'s own doc on retained messages. More... | |
| uint32_t | topic_id |
The confirmed subscription topic matched - see net_mqtt_subscribe()'s own doc on this id. More... | |
| const void* net_mqtt_received_t::payload |
Message payload - NULL if payload_len is 0.
Not caller-owned and only valid for the duration of this callback - copy anything that's still needed once it returns, same as net_mqtt_publish()'s own payload parameter. Read off the wire and buffered in full before this callback runs (a small internal buffer for short messages, a temporary allocation freed right after this callback returns for larger ones) - not streamed, so there's no need to read it "incrementally" to avoid holding the whole message in memory.
| bool net_mqtt_received_t::retain |
True if this is a retained message delivered because of the subscription itself rather than a live publish - see net_mqtt_publish()'s own doc on retained messages.
| const char* net_mqtt_received_t::topic |
Topic the message was published to - may be more specific than the net_mqtt_subscribe() filter that matched it, if that filter used a wildcard.
Not caller-owned, valid only for the duration of this callback.
| uint32_t net_mqtt_received_t::topic_id |
The confirmed subscription topic matched - see net_mqtt_subscribe()'s own doc on this id.
0 if none did, which shouldn't normally happen (a broker only delivers what something here subscribed to) but isn't asserted, since a subscription unsubscribed moments earlier could still have a message in flight. If more than one confirmed filter matches (legal with overlapping wildcards), only the first one found is reported here.