mirror of
https://github.com/boostorg/mqtt5.git
synced 2025-07-29 20:17:37 +02:00
Fix build
Summary: related to T15996 Reviewers: iljazovic Reviewed By: iljazovic Subscribers: miljen Differential Revision: https://repo.mireo.local/D33388
This commit is contained in:
@ -79,15 +79,15 @@ int main(int argc, char** argv) {
|
||||
|
||||
// If you want to use the Client without logging, initialise it with the following line instead.
|
||||
//boost::mqtt5::mqtt_client<
|
||||
// boost::asio::ssl::stream<boost::asio::ip::tcp::socket>,
|
||||
// boost::asio::ssl::context
|
||||
// boost::asio::ssl::stream<boost::asio::ip::tcp::socket>,
|
||||
// boost::asio::ssl::context
|
||||
//> client(ioc, std::move(context));
|
||||
|
||||
client.brokers(cfg.brokers, cfg.port) // Broker that we want to connect to.
|
||||
.credentials(cfg.client_id) // Set the Client Identifier. (optional)
|
||||
.async_run(boost::asio::detached); // Start the Client.
|
||||
|
||||
client.async_publish<boost/mqtt5::qos_e::at_most_once>(
|
||||
client.async_publish<boost::mqtt5::qos_e::at_most_once>(
|
||||
"async-mqtt5/test", "Hello world!",
|
||||
boost::mqtt5::retain_e::no, boost::mqtt5::publish_props{},
|
||||
[&client](boost::mqtt5::error_code ec) {
|
||||
|
@ -80,8 +80,8 @@ int main(int argc, char** argv) {
|
||||
|
||||
// If you want to use the Client without logging, initialise it with the following line instead.
|
||||
//boost::mqtt5::mqtt_client<
|
||||
// boost::beast::websocket::stream<boost::asio::ssl::stream<boost::asio::ip::tcp::socket>>,
|
||||
// boost::asio::ssl::context
|
||||
// boost::beast::websocket::stream<boost::asio::ssl::stream<boost::asio::ip::tcp::socket>>,
|
||||
// boost::asio::ssl::context
|
||||
//> client(ioc, std::move(context));
|
||||
|
||||
client.brokers(cfg.brokers, cfg.port) // Broker that we want to connect to.
|
||||
|
@ -67,7 +67,7 @@ boost::asio::awaitable<void> publish_sensor_readings(
|
||||
auto&& [ec, rc, props] = co_await client.async_publish<boost::mqtt5::qos_e::at_least_once>(
|
||||
"async-mqtt5/test" /* topic */, reading /* payload */,
|
||||
boost::mqtt5::retain_e::no, boost::mqtt5::publish_props {}, use_nothrow_awaitable
|
||||
);
|
||||
);
|
||||
// An error can occur as a result of:
|
||||
// a) wrong publish parameters
|
||||
// b) mqtt_client::cancel is called while the Client is publishing the message
|
||||
|
Reference in New Issue
Block a user