I recommend using Stackless Coroutine (boost::asio::coroutine) because it can avoid deep nested callbacks and higher performance than boost::asio::use_future. C++20 Coroutine is also a good choice. It requires C++20 support. It is more elegant than Stackless Coroutine but a little bit slower than Stackless coroutine.
async_mqtt
Version 10.1.0

Document
See Document
I/O independent protocol library
Boost.Asio style asynchronous APIs support
Completion Token is supported
boost::asio::use_future
boost::asio::coroutine
)yield
notationI recommend using Stackless Coroutine (
boost::asio::coroutine
) because it can avoid deep nested callbacks and higher performance thanboost::asio::use_future
. C++20 Coroutine is also a good choice. It requires C++20 support. It is more elegant than Stackless Coroutine but a little bit slower than Stackless coroutine.High level MQTT client APIs support (since 5.1.0)
See document and example.
Features
Requirement