ST_IotMqttWill

The following information can be used to specify a message that is to be sent as the last message from the client to the broker in the event of an irregular disconnection between client and broker.

Syntax

Definition:

TYPE ST_IotMqttWill :
STRUCT
    sTopic : STRING(255); // topic string (UTF-8) (attend that MQTT topics are case sensitive)
    pPayload : PVOID;
    nPayloadSize : UDINT;
    eQoS : TcIotMqttQos := TcIotMqttQos.ExactlyOnceDelivery; // quality of service between the publishing client and the broker
    bRetain : BOOL; // if TRUE the broker stores the message in order to send it to new subscribers
END_STRUCT
END_TYPE

Parameter

Name

Type

Description

sTopic

STRING(255)

Message topic

pPayload

PVOID

Address for the payload of the message

nPayloadSize

UDINT

Size of the payload in bytes

eQoS

TcIotMqttQos

The “Quality of Service” parameter offers the following setting options: QoS level 0, QoS level 1, QoS level 2 (see QoS)

bRetain

BOOL

If bRetain is TRUE, the broker stores the message in order to make it available to subsequent subscribers.

ST_IotMqttWill 1:

Message payload formatting

Note that the data type and the formatting of the content must be known to the sender and receiver side, particularly when binary information (alignment) or strings (with or without zero termination) are sent.