QMqttPublishProperties#

The QMqttPublishProperties class represents configuration options for sending or receiving a message. More

Inheritance diagram of PySide6.QtMqtt.QMqttPublishProperties

Synopsis#

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#

Invoking publish() to send a message to a broker can include QMqttPublishProperties to provide additional arguments on how the message should be treated on the broker.

Furthermore receiving a message by an instantiated subscription might contain publish properties which have been forwarded or adapted by the server.

Note

Publish properties are part of the MQTT 5.0 specification and cannot be used when connecting with a lower protocol level. See ProtocolVersion for more information.

class PySide6.QtMqtt.QMqttPublishProperties#

PySide6.QtMqtt.QMqttPublishProperties(arg__1)

Parameters:

arg__1PySide6.QtMqtt.QMqttPublishProperties

PySide6.QtMqtt.QMqttPublishProperties.PublishPropertyDetail#

(inherits enum.Flag) This enum type specifies the available properties set by the server or the client when creating a message.

Constant

Description

QMqttPublishProperties.None

No property has been specified.

QMqttPublishProperties.PayloadFormatIndicator

The type of content of the message.

QMqttPublishProperties.MessageExpiryInterval

The duration a message is valid.

QMqttPublishProperties.TopicAlias

The topic alias for this message.

QMqttPublishProperties.ResponseTopic

The topic the receipient should respond to.

QMqttPublishProperties.CorrelationData

An identifier of the response message.

QMqttPublishProperties.UserProperty

Additional properties set by the user.

QMqttPublishProperties.SubscriptionIdentifier

An identifier of subscriptions matching the publication.

QMqttPublishProperties.ContentType

A description of the content of the message.

PySide6.QtMqtt.QMqttPublishProperties.availableProperties()#
Return type:

PublishPropertyDetails

Returns the available properties specified in this instance. When a message is created, it does not need to include all properties. This function serves as an indicator of those properties which have been explicitly set.

PySide6.QtMqtt.QMqttPublishProperties.contentType()#
Return type:

str

Returns the content type of the message.

See also

setContentType()

PySide6.QtMqtt.QMqttPublishProperties.correlationData()#
Return type:

PySide6.QtCore.QByteArray

Returns the correlation data.

PySide6.QtMqtt.QMqttPublishProperties.messageExpiryInterval()#
Return type:

int

Returns the message expiry interval. This value specifies the number of seconds a server is allowed to forward the message. If the interval expires, the server must delete the message and abort publishing it.

PySide6.QtMqtt.QMqttPublishProperties.payloadFormatIndicator()#
Return type:

PayloadFormatIndicator

Returns the payload format indicator.

PySide6.QtMqtt.QMqttPublishProperties.responseTopic()#
Return type:

str

Returns the response topic a user should use as a follow up to a request.

PySide6.QtMqtt.QMqttPublishProperties.setContentType(type)#
Parameters:

type – str

Sets the content type of the message to type.

See also

contentType()

PySide6.QtMqtt.QMqttPublishProperties.setCorrelationData(correlation)#
Parameters:

correlationPySide6.QtCore.QByteArray

Sets the correlation data to correlation.

PySide6.QtMqtt.QMqttPublishProperties.setMessageExpiryInterval(interval)#
Parameters:

interval – int

Sets the message expiry interval to interval.

PySide6.QtMqtt.QMqttPublishProperties.setPayloadFormatIndicator(indicator)#
Parameters:

indicatorPayloadFormatIndicator

Sets the payload format indicator to indicator.

PySide6.QtMqtt.QMqttPublishProperties.setResponseTopic(topic)#
Parameters:

topic – str

Sets the response topic to topic.

See also

responseTopic()

PySide6.QtMqtt.QMqttPublishProperties.setSubscriptionIdentifiers(ids)#
Parameters:

ids

Sets the subscription identifiers to ids.

PySide6.QtMqtt.QMqttPublishProperties.setTopicAlias(alias)#
Parameters:

aliasquint16

Sets the topic alias for publishing a message to alias. A topic alias value must be greater than zero and less than the maximum topic alias specified by the server.

See also

topicAlias() maximumTopicAlias()

PySide6.QtMqtt.QMqttPublishProperties.setUserProperties(properties)#
Parameters:

propertiesQMqttUserProperties

Sets the user properties of a message to properties.

See also

userProperties()

PySide6.QtMqtt.QMqttPublishProperties.subscriptionIdentifiers()#
Return type:

Returns the subscription identifiers of subscriptions matching the topic filter of the message.

PySide6.QtMqtt.QMqttPublishProperties.topicAlias()#
Return type:

quint16

Returns the topic alias used for publishing a message.

See also

setTopicAlias()

PySide6.QtMqtt.QMqttPublishProperties.userProperties()#
Return type:

QMqttUserProperties

Returns the user properties of a message.