mirror of
https://github.com/boostorg/mqtt5.git
synced 2025-07-29 20:17:37 +02:00
Fix async prefix in examples
Summary: related to T15996 Reviewers: iljazovic Reviewed By: iljazovic Subscribers: miljen Differential Revision: https://repo.mireo.local/D33773
This commit is contained in:
@ -30,7 +30,7 @@
|
||||
struct config {
|
||||
std::string brokers = "broker.hivemq.com";
|
||||
uint16_t port = 1883;
|
||||
std::string client_id = "async_mqtt5_tester";
|
||||
std::string client_id = "boost_mqtt5_tester";
|
||||
};
|
||||
|
||||
// client_type with logging enabled
|
||||
@ -59,7 +59,7 @@ boost::asio::awaitable<void> publish_hello_world(
|
||||
.async_run(boost::asio::detached); // Start the Client.
|
||||
|
||||
auto&& [ec, rc, puback_props] = co_await client.async_publish<boost::mqtt5::qos_e::at_least_once>(
|
||||
"async-mqtt5/test" /* topic */, "Hello world!" /* payload*/, boost::mqtt5::retain_e::no,
|
||||
"boost-mqtt5/test" /* topic */, "Hello world!" /* payload*/, boost::mqtt5::retain_e::no,
|
||||
boost::mqtt5::publish_props {}, use_nothrow_awaitable);
|
||||
|
||||
co_await client.async_disconnect(use_nothrow_awaitable);
|
||||
|
@ -27,7 +27,7 @@
|
||||
struct config {
|
||||
std::string brokers = "broker.hivemq.com";
|
||||
uint16_t port = 1883;
|
||||
std::string client_id = "async_mqtt5_tester";
|
||||
std::string client_id = "boost_mqtt5_tester";
|
||||
};
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
@ -78,7 +78,7 @@ int main(int argc, char** argv) {
|
||||
assert(strand.running_in_this_thread());
|
||||
|
||||
client.async_publish<boost::mqtt5::qos_e::at_least_once>(
|
||||
"async-mqtt5/test", "Hello World!", boost::mqtt5::retain_e::no,
|
||||
"boost-mqtt5/test", "Hello World!", boost::mqtt5::retain_e::no,
|
||||
boost::mqtt5::publish_props {},
|
||||
// You may bind the strand to this handler, but it is not necessary
|
||||
// as the strand is already the default associated handler.
|
||||
|
@ -20,7 +20,7 @@
|
||||
struct config {
|
||||
std::string brokers = "broker.hivemq.com";
|
||||
uint16_t port = 1883; // 1883 is the default TCP MQTT port.
|
||||
std::string client_id = "async_mqtt5_tester";
|
||||
std::string client_id = "boost_mqtt5_tester";
|
||||
};
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
@ -53,7 +53,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
//[publish_hello_world
|
||||
client.async_publish<boost::mqtt5::qos_e::at_most_once>(
|
||||
"async-mqtt5/test", "Hello world!",
|
||||
"boost-mqtt5/test", "Hello world!",
|
||||
boost::mqtt5::retain_e::yes, boost::mqtt5::publish_props {},
|
||||
[&client](boost::mqtt5::error_code ec) {
|
||||
std::cout << ec.message() << std::endl;
|
||||
|
@ -22,7 +22,7 @@
|
||||
struct config {
|
||||
std::string brokers = "broker.hivemq.com";
|
||||
uint16_t port = 8883; // 8883 is the default TLS MQTT port.
|
||||
std::string client_id = "async_mqtt5_tester";
|
||||
std::string client_id = "boost_mqtt5_tester";
|
||||
};
|
||||
|
||||
// External customization point.
|
||||
@ -89,7 +89,7 @@ int main(int argc, char** argv) {
|
||||
.async_run(boost::asio::detached); // Start the Client.
|
||||
|
||||
client.async_publish<boost::mqtt5::qos_e::at_most_once>(
|
||||
"async-mqtt5/test", "Hello world!",
|
||||
"boost-mqtt5/test", "Hello world!",
|
||||
boost::mqtt5::retain_e::no, boost::mqtt5::publish_props{},
|
||||
[&client](boost::mqtt5::error_code ec) {
|
||||
std::cout << ec.message() << std::endl;
|
||||
|
@ -22,7 +22,7 @@
|
||||
struct config {
|
||||
std::string brokers = "broker.hivemq.com/mqtt"; // Path example: localhost/mqtt
|
||||
uint16_t port = 8000; // 8083 is the default Webscoket/TCP MQTT port. However, HiveMQ's public broker uses 8000 instead.
|
||||
std::string client_id = "async_mqtt5_tester";
|
||||
std::string client_id = "boost_mqtt5_tester";
|
||||
};
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
@ -52,7 +52,7 @@ int main(int argc, char** argv) {
|
||||
.async_run(boost::asio::detached); // Start the Client.
|
||||
|
||||
client.async_publish<boost::mqtt5::qos_e::at_most_once>(
|
||||
"async-mqtt5/test", "Hello world!",
|
||||
"boost-mqtt5/test", "Hello world!",
|
||||
boost::mqtt5::retain_e::no, boost::mqtt5::publish_props {},
|
||||
[&client](boost::mqtt5::error_code ec) {
|
||||
std::cout << ec.message() << std::endl;
|
||||
|
@ -23,7 +23,7 @@
|
||||
struct config {
|
||||
std::string brokers = "broker.hivemq.com/mqtt"; // Path example: localhost/mqtt
|
||||
uint16_t port = 8884; // 8884 is the default Websocket/TLS MQTT port.
|
||||
std::string client_id = "async_mqtt5_tester";
|
||||
std::string client_id = "boost_mqtt5_tester";
|
||||
};
|
||||
|
||||
// External customization point.
|
||||
@ -88,7 +88,7 @@ int main(int argc, char** argv) {
|
||||
.async_run(boost::asio::detached); // Start the Client.
|
||||
|
||||
client.async_publish<boost::mqtt5::qos_e::at_most_once>(
|
||||
"async-mqtt5/test", "Hello world!",
|
||||
"boost-mqtt5/test", "Hello world!",
|
||||
boost::mqtt5::retain_e::no, boost::mqtt5::publish_props{},
|
||||
[&client](boost::mqtt5::error_code ec) {
|
||||
std::cout << ec.message() << std::endl;
|
||||
|
@ -22,7 +22,7 @@
|
||||
struct config {
|
||||
std::string brokers = "broker.hivemq.com";
|
||||
uint16_t port = 1883;
|
||||
std::string client_id = "async_mqtt5_tester";
|
||||
std::string client_id = "boost_mqtt5_tester";
|
||||
};
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
@ -50,7 +50,7 @@ int main(int argc, char** argv) {
|
||||
// of the previous async_publish call to be invoked.
|
||||
for (auto i = 1; i <= 5; ++i)
|
||||
client.async_publish<boost::mqtt5::qos_e::exactly_once>(
|
||||
"async-mqtt5/test", "Hello world!",
|
||||
"boost-mqtt5/test", "Hello world!",
|
||||
boost::mqtt5::retain_e::no, boost::mqtt5::publish_props {},
|
||||
[i](boost::mqtt5::error_code ec, boost::mqtt5::reason_code rc, boost::mqtt5::pubcomp_props) {
|
||||
std::cout << "Publish number " << i << " completed with: " << std::endl;
|
||||
|
@ -31,7 +31,7 @@
|
||||
struct config {
|
||||
std::string brokers = "broker.hivemq.com";
|
||||
uint16_t port = 1883;
|
||||
std::string client_id = "async_mqtt5_tester";
|
||||
std::string client_id = "boost_mqtt5_tester";
|
||||
};
|
||||
|
||||
// Modified completion token that will prevent co_await from throwing exceptions.
|
||||
@ -65,7 +65,7 @@ boost::asio::awaitable<void> publish_sensor_readings(
|
||||
|
||||
// Publish the sensor reading with QoS 1.
|
||||
auto&& [ec, rc, props] = co_await client.async_publish<boost::mqtt5::qos_e::at_least_once>(
|
||||
"async-mqtt5/test" /* topic */, reading /* payload */,
|
||||
"boost-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:
|
||||
|
@ -29,7 +29,7 @@
|
||||
struct config {
|
||||
std::string brokers = "broker.hivemq.com";
|
||||
uint16_t port = 1883;
|
||||
std::string client_id = "async_mqtt5_tester";
|
||||
std::string client_id = "boost_mqtt5_tester";
|
||||
};
|
||||
|
||||
// Modified completion token that will prevent co_await from throwing exceptions.
|
||||
|
@ -32,7 +32,7 @@
|
||||
struct config {
|
||||
std::string brokers = "broker.hivemq.com";
|
||||
uint16_t port = 1883;
|
||||
std::string client_id = "async_mqtt5_tester";
|
||||
std::string client_id = "boost_mqtt5_tester";
|
||||
};
|
||||
|
||||
// Modified completion token that will prevent co_await from throwing exceptions.
|
||||
@ -54,7 +54,7 @@ boost::asio::awaitable<void> send_over_mqtt(
|
||||
.async_run(boost::asio::detached); // Start the Client.
|
||||
|
||||
auto&& [pec, prc, puback_props] = co_await client.async_publish<boost::mqtt5::qos_e::at_least_once>(
|
||||
"async-mqtt5/test", "Hello World!",
|
||||
"boost-mqtt5/test", "Hello World!",
|
||||
boost::mqtt5::retain_e::no, boost::mqtt5::publish_props {},
|
||||
use_nothrow_awaitable
|
||||
);
|
||||
|
@ -27,7 +27,7 @@
|
||||
struct config {
|
||||
std::string brokers = "broker.hivemq.com";
|
||||
uint16_t port = 1883;
|
||||
std::string client_id = "async_mqtt5_tester";
|
||||
std::string client_id = "boost_mqtt5_tester";
|
||||
};
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
|
@ -40,9 +40,9 @@ using stream_type = asio::ip::tcp::socket;
|
||||
|
||||
constexpr auto broker = "broker.hivemq.com";
|
||||
constexpr auto connect_wait_dur = std::chrono::milliseconds(200);
|
||||
constexpr auto topic = "async-mqtt5/test";
|
||||
constexpr auto share_topic = "$share/sharename/async-mqtt5/test";
|
||||
constexpr auto payload = "hello from async-mqtt5";
|
||||
constexpr auto topic = "boost-mqtt5/test";
|
||||
constexpr auto share_topic = "$share/sharename/boost-mqtt5/test";
|
||||
constexpr auto payload = "hello from boost-mqtt5";
|
||||
|
||||
template <typename TestCase>
|
||||
void run_test(TestCase&& test_case) {
|
||||
|
Reference in New Issue
Block a user