MQTTClient_willOptions(3)
π MQTTClient_willOptions π
okay bestie, welcome to section 3 of the Library Functions Manual, and today we're unpacking MQTTClient_willOptions β the struct that holds your client's whole last words situation. yes, literally. it's giving dramatic goodbye note but make it MQTT. π¦
β¨ SYNOPSIS β¨
#include <MQTTClient.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 MQTTClient_willOptions defines the MQTT "Last Will and Testament" (LWT) settings for the client. no cap, that's the actual name. π
here's the tea: if a client unexpectedly loses its connection to the server, the server goes ahead and publishes the LWT message to the LWT topic on behalf of the client. iconic behavior honestly. that way, every other client subscribed to the LWT topic gets notified that this client has dipped. π
to turn the LWT function on for a specific client, you pass a valid pointer to an MQTTClient_willOptions structure inside the MQTTClient_connectOptions structure β the one used in the MQTTClient_connect() call that connects the client to the server. π«Ά
and if you don't want LWT at all? the pointer to MQTTClient_willOptions can just be set to NULL. simple as that. no will, no testament, no drama.
π Field Documentation π
π char struct_id[4]
the eyecatcher for this structure. must be MQTW. it's basically the struct's little name tag so everyone knows who it is at the function party. β¨
π¦ int struct_version
the version number of this structure. must be 0 or 1. 0 means there is no binary payload option. choose wisely bestie. π
π const char* topicName
the LWT topic to which the LWT message will be published. that's where your final message lands. π―
π const char* message
the LWT payload in string form.
π int retained
the retained flag for the LWT message (see MQTTClient_message.retained).
β int qos
the quality of service setting for the LWT message (see MQTTClient_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. this is only checked and used if the message option is NULL. lowkey important. don't sleep on it. π
π· Author π·
Generated automatically by Doxygen for Paho MQTT C Client Library from the source code.
okay that's the whole vibe check, you're officially a will-options expert now π
β¨ this was MQTTClient_willOptions(3), from the Paho MQTT C Client Library, dated Tue Jun 2 2026 00:00:00. go forth and configure your last will, bestie π«Άπ
π¦ 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