MQTTAsync_willOptions(3)

πŸ’… MQTTAsync_willOptions πŸ’… (NAME)

okay bestie, welcome to the MQTTAsync_willOptions page from the Library Functions Manual β€” this is the struct that holds your client's goodbye note 🫢


✨ SYNOPSIS ✨

#include <MQTTAsync.h>

πŸŽ€ Data Fields πŸŽ€

char struct_id [4]
int struct_version
const char * topicName
const char * message
int retained
int qos
struct {
   int len
   const void * data
} payload

🌸 Detailed Description 🌸

so like. MQTTAsync_willOptions defines the MQTT "Last Will and Testament" (LWT) settings for the client. and the way this works is iconic: if a client unexpectedly loses its connection to the server, the server publishes the LWT message to the LWT topic on behalf of the client. that means every other client subscribed to that LWT topic finds out the client has disconnected. no ghosting, no silence. πŸ’€

to enable the LWT function for a specific client, you pass a valid pointer to an MQTTAsync_willOptions structure in the MQTTAsync_connectOptions structure used in the MQTTAsync_connect() call that connects the client to the server. and if you don't want the LWT function at all? that pointer can just be set to NULL. simple. periodt. ✨


πŸ”₯ Field Documentation πŸ”₯

πŸ’– char struct_id[4]

the eyecatcher for this structure. must be MQTW. no cap, it has to be that exact thing.

πŸ’œ int struct_version

the version number of this structure. must be 0 or 1 β€” 0 indicates no binary will message support.

πŸ¦‹ const char* topicName

the LWT topic that the LWT message will be published to. πŸ‘‘

πŸ“ const char* message

the LWT payload.

🌈 int retained

the retained flag for the LWT message β€” peep MQTTAsync_message.retained if you need the deets.

⭐ int qos

the quality of service setting for the LWT message β€” see MQTTAsync_message.qos and Quality of service.

🧚 int len

binary payload length.

πŸŽ€ const void* data

binary payload data.

πŸ‘‘ struct { ... } payload

the LWT payload in binary form. heads up though: this is only checked and used if the message option is NULL. so if you filled in message, this one's just sitting there minding its own business. πŸ™ˆ


🌟 Author 🌟

Generated automatically by Doxygen for Paho Asynchronous MQTT C Client Library from the source code. (not me writing it by hand, the robots did it πŸ’…)


okay that's the whole page bestie, mwah πŸ’– this was Paho Asynchronous MQTT C Client Library, dated Tue Jun 2 2026 00:00:00 β€” go forth and write your wills responsibly, ily 🫢✨

πŸ“¦ where this page comes from