MQTT C Client Libraries Internals: MQTTAsync_willOptions Struct Reference

| MQTT C Client Libraries Internals

Loading...
Searching...
No Matches
Data Fields
MQTTAsync_willOptions Struct Reference

MQTTAsync_willOptions defines the MQTT "Last Will and Testament" (LWT) settings for the client. More...

`#include <MQTTAsync.h>`

## Data Fields
char | struct_id [4]
| The eyecatcher for this structure.
int | struct_version
| The version number of this structure.
const char * | topicName
| The LWT topic to which the LWT message will be published.
const char * | message
| The LWT payload.
int | retained
| The retained flag for the LWT message (see MQTTAsync_message.retained).
int | qos
| The quality of service setting for the LWT message (see MQTTAsync_message.qos and qos).
struct { |
int len |
| binary payload length
const void * data |
| binary payload data
} | payload
| The LWT payload in binary form.

## Detailed Description

MQTTAsync_willOptions defines the MQTT "Last Will and Testament" (LWT) settings for the client.

In the event that a client unexpectedly loses its connection to the server, the server publishes the LWT message to the LWT topic on behalf of the client. This allows other clients (subscribed to the LWT topic) to be made aware that the client has disconnected. To enable the LWT function for a specific client, a valid pointer to an MQTTAsync_willOptions structure is passed in the MQTTAsync_connectOptions structure used in the MQTTAsync_connect() call that connects the client to the server. The pointer to MQTTAsync_willOptions can be set to NULL if the LWT function is not required.

## Field Documentation

## ◆ [struct]

struct { ... } MQTTAsync_willOptions::payload

The LWT payload in binary form.

This is only checked and used if the message option is NULL

## ◆ struct_id

char MQTTAsync_willOptions::struct_id[4]

The eyecatcher for this structure.

must be MQTW.

## ◆ struct_version

int MQTTAsync_willOptions::struct_version

The version number of this structure.

Must be 0 or 1 0 indicates no binary will message support

The documentation for this struct was generated from the following file:

- MQTTAsync.h