The last field in the Variable header of CONNACK
packet is a set of Properties.
A set contains a Property Length followed by the Properties. A Property consists
of an Identifier and a value.
This section lists all possible CONNACK
Properties and describes
their usage:
Table 1.6. CONNACK properties
Identifier |
Value type |
Description |
---|---|---|
session_expiry_interval |
|
Represents the Session Expiry Internal in seconds. |
receive_maximum |
|
The maximum number of QoS 1 and QoS 2 publications that the Server is willing to process concurrently. |
maximum_qos |
|
The highest QoS the Server supports. |
retain_available |
|
A value of 0 means that retained message are not supported. A value of 1 means they are supported. |
maximum_packet_size |
|
The maximum |
assigned_client_identifier |
|
The Client Identifier which was assigned by the Server because
a zero length Client Identifier was found in the |
topic_alias_maximum |
|
The highest value that the Server will accept as a Topic Alias sent by the Client. |
reason_string |
|
A UTF-8 Encoded String representing the reason associated with this response. |
user_property |
|
Name, value pair ( |
wildcard_subscription_available |
|
A value of 0 means that Wildcard Subscriptions are not supported. A value of 1 means they are supported. If not present, they are supported. |
subscription_identifier_available |
|
A value of 0 means that Subscriptions Identifiers are not supported. A value of 1 means they are supported. If not present, they are supported. |
shared_subscription_available |
|
A value of 0 means that Shared Subscriptions are not supported. A value of 1 means they are supported. If not present, they are supported. |
server_keep_alive |
|
The Keep Alive time assigned by the Server. |
response_information |
|
A UTF-8 Encoded String which is used as the basis for creating a Response Topic. |
server_reference |
|
A UTF-8 Encoded String which can be used by the Client to identfy another Server to use. |
authentication_method |
|
A UTF-8 Encoded String containing the name of the authentication method used for extended authentication. |
authentication_data |
|
Binary Data containing authentication data. The contents of the data are defined by the authentication method. |
After obtaining an instance of async_mqtt5::connack_props
,
the subscript operator can be used to access a Property.
The Identifiers listed in the table above are available within the async_mqtt5::prop
namespace for Property access.
![]() |
Note |
---|---|
When accessing a property value, the subscript operator will return a
|
The following example shows how to set a Property value:
async_mqtt5::connack_props props; props[async_mqtt5::prop::maximum_packet_size] = 65535; props[async_mqtt5::prop::assigned_client_identifier] = "ClientID"; props[async_mqtt5::prop::user_property].emplace_back("name", "value");
The following example shows how to retrieve a Property value:
std::optional<std::string> auth_method = props[async_mqtt5::prop::authentication_method]; if (auth_method.has_value()) // authentication method property was previously set else // authentication method property was not set std::vector<std::pair<std::string, std::string>>& user_props = props[async_mqtt5::prop::user_property]; if (!user_props.empty()) // user property was previously set else // user property was not set