Document LoggerType concept and improve Getting Started chapter

Summary:
related to T15252, T15261, T15263, #24

- documented LoggerType concept
- configuring the client chapter changed to getting started chapter with new additions:
	- code examples for each section (choosing underlying type, configuring the client, and using it)
	- added a secion on debugging the client using our logger implementation
- minor fixes related to reviewer's suggestions

Reviewers: ivica

Reviewed By: ivica

Subscribers: iljazovic, miljen

Differential Revision: https://repo.mireo.local/D32487
This commit is contained in:
Korina Šimičević
2024-11-29 09:53:34 +01:00
parent 67152be209
commit 319d024981
18 changed files with 235 additions and 75 deletions

View File

@ -15,23 +15,36 @@
#include <async_mqtt5.hpp>
int main() {
//[init_tcp_client
// Initialize the execution context required to run I/O operations.
boost::asio::io_context ioc;
// Construct the Client with ``__TCP_SOCKET__`` as the underlying stream.
async_mqtt5::mqtt_client<boost::asio::ip::tcp::socket> client(ioc);
//async_mqtt5::mqtt_client<boost::asio::ip::tcp::socket> client(ioc);
async_mqtt5::mqtt_client<boost::asio::ip::tcp::socket, std::monostate /* TlsContext */, async_mqtt5::logger> client(
ioc, {} /* tls_context */, async_mqtt5::logger(async_mqtt5::log_level::debug)
);
//]
//[configure_tcp_client
// 1883 is the default TCP MQTT port.
client.brokers("broker.hivemq.com", 1883)
.credentials("async_mqtt5_tester")
.async_run(boost::asio::detached);
//]
//[publish_hello_world
client.async_publish<async_mqtt5::qos_e::at_most_once>(
"async-mqtt5/test", "Hello world!",
async_mqtt5::retain_e::yes, async_mqtt5::publish_props {},
[&client](async_mqtt5::error_code ec) {
std::cout << ec.message() << std::endl;
// Disconnnect the Client.
client.async_disconnect(boost::asio::detached);
}
);
//]
ioc.run();
}