Boost
C++ Libraries
...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
This version of Boost is under active development. You are currently in the develop branch. The current version is 1.92.0.
Send an UNSUBSCRIBE packet to Broker
to unsubscribe from one or more Topics.
template<
typename CompletionToken = typename asio::default_completion_token<boost::mqtt5::mqtt_client::executor_type>::type>
decltype(auto)
async_unsubscribe(
const std::vector< std::string >& topics,
const unsubscribe_props& props,
CompletionToken&& token = {});
The Client may still receive residual Application Messages through the
mqtt_client::async_receive function from
Topics the Client just unsubscribed to.
|
Name |
Description |
|---|---|
|
|
List of Topics to unsubscribe from. |
|
|
An instance of |
|
|
Completion token that will be used to produce a completion
handler. The handler will be invoked when the operation completes.
On immediate completion, invocation of the handler will be
performed in a manner equivalent to using |
The handler signature for this operation:
void (, // Result of operation. std::vector<boost::mqtt5::error_code>, // Vector of Reason Codes indicating // the result of unsubscribe operation // for each Topic in the UNSUBSCRIBE packet.boost::mqtt5::reason_codeboost::mqtt5::unsuback_props, // Properties received in the UNSUBACK packet. )
The asynchronous operation will complete when one of the following conditions is true:
UNSUBSCRIBE packet and
has received an UNSUBACK response from
the Broker.
boost::mqtt5::error_code in
the handler.
The list of all possible error codes that this operation can finish with:
boost::system::errc::errc_t::success
boost::asio::error::operation_aborted
boost::mqtt5::client::error::malformed_packet
boost::mqtt5::client::error::packet_too_large
boost::mqtt5::client::error::pid_overrun
boost::mqtt5::client::error::invalid_topic
Refer to the section on Error handling
to find the underlying causes for each error code.
This asynchronous operation supports cancellation for the following
boost::asio::cancellation_type
values:
cancellation_type::terminal
- invokes mqtt_client::cancel
cancellation_type::partial
& cancellation_type::total
- prevents potential resending of the UNSUBSCRIBE packet