MQTT.Message

Description

This class defines an MQTT message. The MQTT.Client class sends and receives MQTT messages.

Properties

id The id of the message.
payload The content of the message.
properties The set of properties sent with the message.
qos The quality of service for this message.
retain Whether or not the broker should retain the message.
topic The topic of the message.

Constructor

MQTT.Message

Details

Do no remove, this fixes the anchor on doc.flexsim.com

MQTT.Message.id

readonly int id

Description

The id of the message.

The id is set in two cases:
  1. Immediately after the message is published, and
  2. When a message is received.
The meaning of the ID is usually dependent on broker behavior.
Do no remove, this fixes the anchor on doc.flexsim.com

MQTT.Message.payload

string payload

Description

The content of the message.

The payload of a message is the data that is communicated.
Do no remove, this fixes the anchor on doc.flexsim.com

MQTT.Message.properties

Map properties

Description

The set of properties sent with the message.

Only for use with MQTT 5.0. Usually left blank. See the MQTT.Client class documentation for more information.
Do no remove, this fixes the anchor on doc.flexsim.com

MQTT.Message.qos

int qos

Description

The quality of service for this message.

Set to determine the quality of service for publishing. Get to determine the quality of service used when the message was sent.
Do no remove, this fixes the anchor on doc.flexsim.com

MQTT.Message.retain

int retain

Description

Whether or not the broker should retain the message.

The broker will keep the latest retained message for each topic. Set this to mark a message as retained when publishing. Get this to determine whether a message was retained by the broker when the message was sent.
Do no remove, this fixes the anchor on doc.flexsim.com

MQTT.Message.topic

topic

Description

The topic of the message.

The topic is an identifier. MQTT topics are usually similar to a path, such as "myhome/groudfloor/livingroom/temperature".
Do no remove, this fixes the anchor on doc.flexsim.com

MQTT.Message Constructor

MQTT.Message( string topic , string payload , int qos = 0 , int retain = 0 )
MQTT.Message( string topic , string payload , int qos , int retain , Map properties )
MQTT.Message( Variant v )

Parameters

topic The topic of the message
payload The payload of the message
qos The quality of service for the message
retain Whether the message is retained
properties Properties sent with the message (MQTT 5.0)
v A Variant value that defines a message

Description

The first case constructs a message with the given parameters:
MQTT.Message msg = MQTT.Message("some/topic", "content", 1, 1);
The second case is used when accessing a message passed in to a callback function.