QMqttMessage#

The QMqttMessage class provides information about a message received from a message broker based on a subscription. More

Inheritance diagram of PySide6.QtMqtt.QMqttMessage

Synopsis#

Properties#

  • duplicate - This property holds whether the message is a duplicate

  • id - This property holds the ID of the message

  • payload - This property holds the payload of a message

  • qos - This property holds the QoS level of a message

  • retain - This property holds whether the message has been retained

  • topic - This property holds the topic of a message

Functions#

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description#

An MQTT message is created inside the module and returned via the messageReceived() signal.

class PySide6.QtMqtt.QMqttMessage#

PySide6.QtMqtt.QMqttMessage(other)

Parameters:

otherPySide6.QtMqtt.QMqttMessage

Creates a new MQTT message.

Constructs a new MQTT message that is a copy of other.

Note

Properties can be used directly when from __feature__ import true_property is used or via accessor functions otherwise.

property PᅟySide6.QtMqtt.QMqttMessage.duplicate: bool#

This property holds This property holds whether the message is a duplicate..

Duplicate messages indicate that the message has been sent earlier, but it has not been confirmed yet. Hence, the broker assumes that it needs to resend to verify the transport of the message itself. Duplicate messages can only occur if the QoS level is one or two.

Access functions:
property PᅟySide6.QtMqtt.QMqttMessage.id: quint16#

This property holds This property holds the ID of the message..

IDs are used for messages with a QoS level above zero.

Access functions:
property PᅟySide6.QtMqtt.QMqttMessage.payload: PySide6.QtCore.QByteArray#

This property holds This property holds the payload of a message..

Access functions:
property PᅟySide6.QtMqtt.QMqttMessage.qos: quint8#

This property holds This property holds the QoS level of a message..

Access functions:
property PᅟySide6.QtMqtt.QMqttMessage.retain: bool#

This property holds This property holds whether the message has been retained..

A retained message is kept on the broker for future clients to subscribe. Consequently, a retained message has been created previously and is not a live update. A broker can store only one retained message per topic.

Access functions:
property PᅟySide6.QtMqtt.QMqttMessage.topic: PySide6.QtMqtt.QMqttTopicName#

This property holds This property holds the topic of a message..

In case a wildcard has been used for a subscription, describes the topic matching this subscription. This property never contains wildcards.

Access functions:
PySide6.QtMqtt.QMqttMessage.duplicate()#
Return type:

bool

Getter of property duplicate .

PySide6.QtMqtt.QMqttMessage.id()#
Return type:

quint16

Getter of property id .

PySide6.QtMqtt.QMqttMessage.__eq__(other)#
Parameters:

otherPySide6.QtMqtt.QMqttMessage

Return type:

bool

Returns true if the message and other are equal, otherwise returns false.

PySide6.QtMqtt.QMqttMessage.payload()#
Return type:

PySide6.QtCore.QByteArray

Getter of property payload .

PySide6.QtMqtt.QMqttMessage.publishProperties()#
Return type:

PySide6.QtMqtt.QMqttPublishProperties

Returns the publish properties received as part of the message.

Note

This function only specifies the properties when a publish message is received. Messages with a QoS value of 1 or 2 can contain additional properties when a message is released. Those can be obtained by the messageStatusChanged signal.

Note

This function will only provide valid data when the client specifies MQTT_5_0 as ProtocolVersion .

PySide6.QtMqtt.QMqttMessage.qos()#
Return type:

quint8

Getter of property qos .

PySide6.QtMqtt.QMqttMessage.retain()#
Return type:

bool

Getter of property retain .

PySide6.QtMqtt.QMqttMessage.topic()#
Return type:

PySide6.QtMqtt.QMqttTopicName

Getter of property topic .