Asynchronous MQTT communication library.
This is Boost.Asio oriented asynchronous MQTT communication library. You can use async_mqtt to develop not only your MQTT client application but also your server (e.g. broker). Based on https://github.com/redboltz/mqtt_cpp experience, there are many improvements. See overview.
Document is https://github.com/redboltz/async_mqtt/blob/doc/README.adoc
Completion Token is supported
- Callbacks
- Can wait mutiple events
- High performance
- Deep callback nesting
- For simple and continuous multiple waiting usecases
- example/ep_cb_mqtt_client.cpp
boost::asio::use_future
- Can't wait multiple events
- Less performance than callbacks and stackless coroutines
- Easy to read
- For simple and straight usecases
- example/ep_future_mqtt_client.cpp
- Stackless Coroutine (
boost::asio::coroutine
)- Can wait multiple event. You can distinguish which event is invoked by operator()'s overloaded parameter.
- High performance
- Easy to read but difficult to learn
yield
notation - example/ep_slcoro_mqtt_client.cpp
- C++20Coroutine
- Can wait multiple event.
- High performance. (But a little bit slower than Stackless Coroutine)
- Easy to read.
- example/ep_slcoro_mqtt_client.cpp
- and more
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.
- Compiler: C++17 or later
- Boost Libraries: 1.81.0 or later