mirror of
https://github.com/boostorg/mqtt5.git
synced 2025-07-29 20:17:37 +02:00
Update documentation
Summary: related to T12804 - fixes in publisher and receiver examples - update year to 2024 - remove extra documentation link in README - remove unnecessary copyright & license section, it is automatically generated from 00_main.qbk Reviewers: ivica Reviewed By: ivica Subscribers: miljen, iljazovic Differential Revision: https://repo.mireo.local/D27889
This commit is contained in:
@ -15,10 +15,10 @@
|
||||
namespace asio = boost::asio;
|
||||
|
||||
asio::awaitable<void> client_publisher(asio::io_context& ioc) {
|
||||
// Initialise the ``__Client__``, establish connection to the Broker over TCP.
|
||||
// Initialise the Client, establish connection to the Broker over TCP.
|
||||
async_mqtt5::mqtt_client<asio::ip::tcp::socket> client(ioc, "");
|
||||
|
||||
// Configure the ``__Client__``.
|
||||
// Configure the Client.
|
||||
// It is mandatory to call brokers() and async_run() to configure the Brokers to connect to and start the Client.
|
||||
client.brokers("mqtt.broker", 1883) // Broker that we want to connect to. 1883 is the default TCP port.
|
||||
.async_run(asio::detached); // Start the client.
|
||||
@ -54,6 +54,6 @@ int main() {
|
||||
ioc.run();
|
||||
}
|
||||
|
||||
//]
|
||||
|
||||
#endif
|
||||
|
||||
//]
|
||||
|
@ -15,10 +15,10 @@
|
||||
namespace asio = boost::asio;
|
||||
|
||||
asio::awaitable<void> client_receiver(asio::io_context& ioc) {
|
||||
// Initialise the ``__Client__``, establish connection to the Broker over TCP.
|
||||
// Initialise the Client, establish connection to the Broker over TCP.
|
||||
async_mqtt5::mqtt_client<asio::ip::tcp::socket> client(ioc, "");
|
||||
|
||||
// Configure the``__Client__``.
|
||||
// Configure the Client.
|
||||
// It is mandatory to call brokers() and async_run() to configure the Brokers to connect to and start the Client.
|
||||
client.brokers("mqtt.broker", 1883) // Broker that we want to connect to. 1883 is the default TCP port.
|
||||
.async_run(asio::detached); // Start the client.
|
||||
@ -44,7 +44,7 @@ asio::awaitable<void> client_receiver(asio::io_context& ioc) {
|
||||
// Before attempting to receive an Application Message from the Topic we just subscribed to,
|
||||
// it is advisable to verify that the subscription succeeded.
|
||||
// It is not recommended to call mqtt_client::async_receive if you do not have any
|
||||
// Subscription established as the corresponding handler will never be invoked.
|
||||
// subscription established as the corresponding handler will never be invoked.
|
||||
if (!sub_codes[0])
|
||||
auto [topic, payload, publish_props] = co_await client.async_receive(asio::use_awaitable);
|
||||
// Receive more messages...
|
||||
@ -79,6 +79,6 @@ int main() {
|
||||
ioc.run();
|
||||
}
|
||||
|
||||
//]
|
||||
|
||||
#endif
|
||||
|
||||
//]
|
||||
|
Reference in New Issue
Block a user