ST_IotMqttWill
By means of the following specifications, a message can be specified which, in case of an irregular disconnection between client and broker, is sent as the last message from the broker to the subscribers who have subscribed to the corresponding topic.
Syntax
Definition:
TYPE ST_IotMqttWill :
STRUCT
{attribute 'TcEncoding':='UTF-8'}
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. |
![]() | 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. |