QMqttPublishProperties Class▲
-
Header: QMqttPublishProperties
-
Since: Qt 5.12
-
qmake: QT += mqtt
Detailed Description▲
Invoking QMqttClient::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.
Publish properties are part of the MQTT 5.0 specification and cannot be used when connecting with a lower protocol level. See QMqttClient::ProtocolVersion for more information.
Member Type Documentation▲
enum QMqttPublishProperties::PublishPropertyDetail▲
flags QMqttPublishProperties::PublishPropertyDetails
This enum type specifies the available properties set by the server or the client when creating a message.
Constant |
Value |
Description |
---|---|---|
QMqttPublishProperties::None |
0x00000000 |
No property has been specified. |
QMqttPublishProperties::PayloadFormatIndicator |
0x00000001 |
The type of content of the message. |
QMqttPublishProperties::MessageExpiryInterval |
0x00000002 |
The duration a message is valid. |
QMqttPublishProperties::TopicAlias |
0x00000004 |
The topic alias for this message. |
QMqttPublishProperties::ResponseTopic |
0x00000008 |
The topic the receipient should respond to. |
QMqttPublishProperties::CorrelationData |
0x00000010 |
An identifier of the response message. |
QMqttPublishProperties::UserProperty |
0x00000020 |
Additional properties set by the user. |
QMqttPublishProperties::SubscriptionIdentifier |
0x00000040 |
An identifier of subscriptions matching the publication. |
QMqttPublishProperties::ContentType |
0x00000080 |
A description of the content of the message. |
The PublishPropertyDetails type is a typedef for QFlags<PublishPropertyDetail>. It stores an OR combination of PublishPropertyDetail values.
Member Function Documentation▲
QMqttPublishProperties::PublishPropertyDetails QMqttPublishProperties::availableProperties() const▲
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.
QString QMqttPublishProperties::contentType() const▲
QByteArray QMqttPublishProperties::correlationData() const▲
quint32 QMqttPublishProperties::messageExpiryInterval() const▲
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.
See Also▲
See also setMessageExpiryInterval()
QMqtt::PayloadFormatIndicator QMqttPublishProperties::payloadFormatIndicator() const▲
QString QMqttPublishProperties::responseTopic() const▲
Returns the response topic a user should use as a follow up to a request.
See Also▲
See also setResponseTopic()
void QMqttPublishProperties::setContentType(const QString &type)▲
void QMqttPublishProperties::setCorrelationData(const QByteArray &correlation)▲
void QMqttPublishProperties::setMessageExpiryInterval(quint32 interval)▲
void QMqttPublishProperties::setPayloadFormatIndicator(QMqtt::PayloadFormatIndicator indicator)▲
void QMqttPublishProperties::setResponseTopic(const QString &topic)▲
void QMqttPublishProperties::setSubscriptionIdentifiers(const QList<quint32> &ids)▲
void QMqttPublishProperties::setTopicAlias(quint16 alias)▲
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▲
See also topicAlias(), QMqttServerConnectionProperties::maximumTopicAlias()
void QMqttPublishProperties::setUserProperties(const QMqttUserProperties &properties)▲
QList<quint32> QMqttPublishProperties::subscriptionIdentifiers() const▲
Returns the subscription identifiers of subscriptions matching the topic filter of the message.
See Also▲
See also setSubscriptionIdentifiers()