The QMqttServerConnectionProperties class represents configuration options of a server a QMqttClient is connected to. 更多...
头: | #include <QMqttServerConnectionProperties> |
qmake: | QT += mqtt |
Since: | Qt 5.12 |
继承: | QMqttConnectionProperties |
enum | ServerPropertyDetail { None, SessionExpiryInterval, MaximumReceive, MaximumQoS, RetainAvailable, …, AuthenticationData } |
flags | ServerPropertyDetails |
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 |
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.
注意: Connection properties are part of the MQTT 5.0 specification and cannot be used when connecting with a lower protocol level. See QMqttClient::ProtocolVersion 了解更多信息。
This enum type specifies the available properties set by the server or the client after establishing a connection.
常量 | 值 | 描述 |
---|---|---|
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.
Returns the available properties specified by the server.
返回
true
if the server assigned a new client identifier to the client.
另请参阅 QMqttClient::clientId ().
返回
true
if the server provided properties as part of the connection aknowledgment. Returns
false
if no properties have been provided.
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.
默认值为
2
.
另请参阅 QMqttClient::publish () 和 QMqttClient::subscribe ().
Returns the reason string associated with this response.
Returns the reason code associated with this response.
Returns the response information.
返回
true
if the server accepts retained messages. The default value is
true
.
Returns the number of seconds the server requested as keep alive. This overwrites the keep alive being set from the client side.
另请参阅 QMqttClient::setKeepAlive ().
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).
返回
true
if the server accepts shared subscriptions. The default value is
true
.
返回
true
if the server accepts subscription identifiers. Subscription identifiers can be passed to the server when creating a new subscription.
默认值为
true
.
另请参阅 QMqttSubscriptionProperties::setSubscriptionIdentifier ().
返回
true
if the server accepts subscriptions including wildcards. The default value is
true
.