PySide6.QtMqtt.QMqttPublishProperties

class QMqttPublishProperties

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

Synopsis

Methods

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 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.

__init__()
__init__(arg__1)
Parameters:

arg__1QMqttPublishProperties

availableProperties()
Return type:

Combination of PublishPropertyDetail

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.

contentType()
Return type:

str

Returns the content type of the message.

See also

setContentType()

correlationData()
Return type:

QByteArray

Returns the correlation data.

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.

payloadFormatIndicator()
Return type:

PayloadFormatIndicator

Returns the payload format indicator.

responseTopic()
Return type:

str

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

setContentType(type)
Parameters:

type – str

Sets the content type of the message to type.

See also

contentType()

setCorrelationData(correlation)
Parameters:

correlationQByteArray

Sets the correlation data to correlation.

setMessageExpiryInterval(interval)
Parameters:

interval – int

Sets the message expiry interval to interval.

setPayloadFormatIndicator(indicator)
Parameters:

indicatorPayloadFormatIndicator

Sets the payload format indicator to indicator.

setResponseTopic(topic)
Parameters:

topic – str

Sets the response topic to topic.

See also

responseTopic()

setSubscriptionIdentifiers(ids)
Parameters:

ids – .list of quint32

Sets the subscription identifiers to ids.

setTopicAlias(alias)
Parameters:

alias – int

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()

setUserProperties(properties)
Parameters:

propertiesQMqttUserProperties

Sets the user properties of a message to properties.

See also

userProperties()

subscriptionIdentifiers()
Return type:

.list of quint32

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

topicAlias()
Return type:

int

Returns the topic alias used for publishing a message.

See also

setTopicAlias()

userProperties()
Return type:

QMqttUserProperties

Returns the user properties of a message.