mirror of
https://github.com/boostorg/mqtt5.git
synced 2025-11-15 15:09:31 +01:00
Summary: related to T12804 Reviewers: ivica Reviewed By: ivica Subscribers: iljazovic, miljen Differential Revision: https://repo.mireo.local/D26219
42 lines
2.2 KiB
Plaintext
42 lines
2.2 KiB
Plaintext
[/
|
|
Copyright (c) 2023 Mireo
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
]
|
|
|
|
[section:publish_props PUBLISH properties]
|
|
The last field in the Variable header of __PUBLISH__ 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 __PUBLISH__ Properties and describes their usage:
|
|
|
|
[table:publish_props PUBLISH properties
|
|
[[Identifier] [Value type] [Description]]
|
|
[[payload_format_indicator] [`uint8_t`] [Value of 0 indicates that the Payload is in unspecified bytes. Value of 1 indicates that the Payload is UTF-8 Encoded Character Data.]]
|
|
[[message_expiry_interval] [`int32_t`] [The lifetime of the Application Message in seconds.]]
|
|
[[topic_alias] [`int16_t`] [Two Byte integer representing the Topic Alias, an integer value that is used to identify the Topic instead of using the Topic Name.]]
|
|
[[response_topic] [`std::string`] [A UTF-8 Encoded String which is used as the Topic Name for a response message.]]
|
|
[[correlation_data] [`std::string`] [Binary Data used by the sender of the Request Message to identify which request the Response Message is for when it is received.]]
|
|
[[user_property] [`std::vector<std::string>`] [A list of name, value pairs (__UTF8_STRING_PAIR__) defining User Properties.
|
|
The meaning of these properties is not defined by the specification.]]
|
|
[[subscription_identifier] [`uint32_t`] [Identifier of the Subscription in range of 1 to 268,435,455.]]
|
|
[[content_type] [`std::string`] [A UTF-8 Encoded String describing the content of the Application Message.]]
|
|
]
|
|
|
|
[h4 Usage]
|
|
After obtaining an instance of `async_mqtt5::publish_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.
|
|
|
|
[h4 Example]
|
|
|
|
[!c++]
|
|
async_mqtt5::publish_props props;
|
|
props[async_mqtt5::prop::payload_format_indicator] = uint8_t(1);
|
|
props[async_mqtt5::prop::topic_alias] = uint16_t(12);
|
|
props[async_mqtt5::prop::response_topic] = "response_topic";
|
|
|
|
[endsect]
|