W3cubDocs

/Qt

QMqttServerConnectionProperties Class

The QMqttServerConnectionProperties class represents configuration options of a server a QMqttClient is connected to. More...

Header: #include <QMqttServerConnectionProperties>
qmake: QT += mqtt
Since: Qt 5.12
Inherits: QMqttConnectionProperties

Public Types

enum ServerPropertyDetail { None, SessionExpiryInterval, MaximumReceive, MaximumQoS, RetainAvailable, …, AuthenticationData }
flags ServerPropertyDetails

Public Functions

QMqttServerConnectionProperties::ServerPropertyDetails availableProperties() const
bool clientIdAssigned() const
bool isValid() const
quint8 maximumQoS() const
QString reason() const
QMqtt::ReasonCode reasonCode() const
QString responseInformation() const
bool retainAvailable() const
quint16 serverKeepAlive() const
QString serverReference() const
bool sharedSubscriptionSupported() const
bool subscriptionIdentifierSupported() const
bool wildcardSupported() const

Detailed Description

When a connection has been established the server might send additional details about the connection properties. Use availableProperties() to identify properties set by the server. If a property is not set by the server, default values are assumed and can be obtained by invoking access functions of this instance.

Note: Connection 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 QMqttServerConnectionProperties::ServerPropertyDetailflags QMqttServerConnectionProperties::ServerPropertyDetails

This enum type specifies the available properties set by the server or the client after establishing a connection.

Constant Value Description
QMqttServerConnectionProperties::None 0x00000000 No property has been specified.
QMqttServerConnectionProperties::SessionExpiryInterval 0x00000001 The number of seconds the server keeps the session after a disconnect.
QMqttServerConnectionProperties::MaximumReceive 0x00000002 The maximum number of QoS 1 and 2 message the server is capable of managing concurrently.
QMqttServerConnectionProperties::MaximumQoS 0x00000004 The maximum QoS level the server can understand.
QMqttServerConnectionProperties::RetainAvailable 0x00000010 Specifies whether retained messages are supported.
QMqttServerConnectionProperties::MaximumPacketSize 0x00000020 Specifies the maximum packet size including the message header and properties.
QMqttServerConnectionProperties::AssignedClientId 0x00000040 Specifies whether the server assigned a client identifier.
QMqttServerConnectionProperties::MaximumTopicAlias 0x00000080 Specifies the maximum amount of topic aliases.
QMqttServerConnectionProperties::ReasonString 0x00000100 Specifies a string providing more details on connection state.
QMqttServerConnectionProperties::UserProperty 0x00000200 Specifies additional user properties.
QMqttServerConnectionProperties::WildCardSupported 0x00000400 Specifies whether the server supports wildcard subscriptions.
QMqttServerConnectionProperties::SubscriptionIdentifierSupport 0x00000800 Specifies whether the server supports subscription identifiers.
QMqttServerConnectionProperties::SharedSubscriptionSupport 0x00001000 Specifies whether the server supports shared subscriptions.
QMqttServerConnectionProperties::ServerKeepAlive 0x00002000 Specifies the number of seconds the server expects a keep alive packet from the client.
QMqttServerConnectionProperties::ResponseInformation 0x00004000 Specifies the response information.
QMqttServerConnectionProperties::ServerReference 0x00008000 Specifies an alternative server address for the client to connect to.
QMqttServerConnectionProperties::AuthenticationMethod 0x00010000 Specifies the authentication method.
QMqttServerConnectionProperties::AuthenticationData 0x00020000 Specifies the authentication data.

The ServerPropertyDetails type is a typedef for QFlags<ServerPropertyDetail>. It stores an OR combination of ServerPropertyDetail values.

Member Function Documentation

QMqttServerConnectionProperties::ServerPropertyDetails QMqttServerConnectionProperties::availableProperties() const

Returns the available properties specified by the server.

bool QMqttServerConnectionProperties::clientIdAssigned() const

Returns true if the server assigned a new client identifier to the client.

See also QMqttClient::clientId().

bool QMqttServerConnectionProperties::isValid() const

Returns true if the server provided properties as part of the connection aknowledgment. Returns false if no properties have been provided.

quint8 QMqttServerConnectionProperties::maximumQoS() const

Returns the maximum QoS level the server supports for publishing messages. Publishing messages with QoS level exceeding the maximum QoS level reported by the server is a protocol violation.

If the client does not need to support QoS 1 or QoS 2, it should restrict the maximum QoS level in any subscription it does to a value it can support; the server would then publish messages with the maximum of supported and restricted QoS levels.

The default value is 2.

See also QMqttClient::publish() and QMqttClient::subscribe().

QString QMqttServerConnectionProperties::reason() const

Returns the reason string associated with this response.

QMqtt::ReasonCode QMqttServerConnectionProperties::reasonCode() const

Returns the reason code associated with this response.

QString QMqttServerConnectionProperties::responseInformation() const

Returns the response information.

bool QMqttServerConnectionProperties::retainAvailable() const

Returns true if the server accepts retained messages. The default value is true.

quint16 QMqttServerConnectionProperties::serverKeepAlive() const

Returns the number of seconds the server requested as keep alive. This overwrites the keep alive being set from the client side.

See also QMqttClient::setKeepAlive().

QString QMqttServerConnectionProperties::serverReference() const

Returns a server address which can be used by the client alternatively to connect to. Typically, this is used together with the reason code 0x9c (Use another server) or 0x9c (Server moved).

bool QMqttServerConnectionProperties::sharedSubscriptionSupported() const

Returns true if the server accepts shared subscriptions. The default value is true.

bool QMqttServerConnectionProperties::subscriptionIdentifierSupported() const

Returns true if the server accepts subscription identifiers. Subscription identifiers can be passed to the server when creating a new subscription.

The default value is true.

See also QMqttSubscriptionProperties::setSubscriptionIdentifier().

bool QMqttServerConnectionProperties::wildcardSupported() const

Returns true if the server accepts subscriptions including wildcards. The default value is true.

© The Qt Company Ltd
Licensed under the GNU Free Documentation License, Version 1.3.
https://doc.qt.io/qt-6.2/qmqttserverconnectionproperties.html