forked from boostorg/mqtt5
[mqtt-client] add readme & license, doc fixes
Summary: resolves T13126 Reviewers: ivica Reviewed By: ivica Subscribers: miljen, iljazovic Maniphest Tasks: T13126 Differential Revision: https://repo.mireo.local/D26629
This commit is contained in:
1 parent
cda3bc8ee1
commit
e191679889
9 files changed
+233
-93
No files matched your search
+16
-19
@@ -1,4 +1,4 @@
|
||||
#include <fmt/format.h>
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/asio/io_context.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
@@ -68,6 +68,7 @@ constexpr const char spacetime_ca[] =
|
||||
;
|
||||
|
||||
void publish_qos0_websocket_tls() {
|
||||
std::cout << "[Test-publish-qos0-websocket-tls]" << std::endl;
|
||||
using namespace async_mqtt5;
|
||||
asio::io_context ioc;
|
||||
|
||||
@@ -92,7 +93,7 @@ void publish_qos0_websocket_tls() {
|
||||
"test/mqtt-test", "hello world with qos0!",
|
||||
retain_e::no, publish_props{},
|
||||
[&c](error_code ec) {
|
||||
fmt::print("[Test-publish-qos0-websocket-tls] error_code: {}\n", ec.message());
|
||||
std::cout << "error_code: " << ec.message() << std::endl;
|
||||
c.cancel();
|
||||
}
|
||||
);
|
||||
@@ -102,6 +103,7 @@ void publish_qos0_websocket_tls() {
|
||||
}
|
||||
|
||||
void publish_qos1_websocket_tls() {
|
||||
std::cout << "[Test-publish-qos1-websocket-tls]" << std::endl;
|
||||
using namespace async_mqtt5;
|
||||
asio::io_context ioc;
|
||||
|
||||
@@ -126,10 +128,8 @@ void publish_qos1_websocket_tls() {
|
||||
"test/mqtt-test", "hello world with qos1!",
|
||||
retain_e::no, publish_props{},
|
||||
[&c](error_code ec, reason_code rc, puback_props) {
|
||||
fmt::print(
|
||||
"[Test-publish-qos1-websocket-tls] "
|
||||
"error_code: {}, reason_code: {}\n", ec.message(), rc.message()
|
||||
);
|
||||
std::cout << "error_code: " << ec.message() << std::endl;
|
||||
std::cout << "reason_code: " << rc.message() << std::endl;
|
||||
c.cancel();
|
||||
}
|
||||
);
|
||||
@@ -139,6 +139,7 @@ void publish_qos1_websocket_tls() {
|
||||
}
|
||||
|
||||
void publish_qos2_websocket_tls() {
|
||||
std::cout << "[Test-publish-qos2-websocket-tls]" << std::endl;
|
||||
using namespace async_mqtt5;
|
||||
asio::io_context ioc;
|
||||
|
||||
@@ -163,10 +164,8 @@ void publish_qos2_websocket_tls() {
|
||||
"test/mqtt-test", "hello world with qos2!",
|
||||
retain_e::no, publish_props{},
|
||||
[&c](error_code ec, reason_code rc, pubcomp_props) {
|
||||
fmt::print(
|
||||
"[Test-publish-qos2-websocket-tls] "
|
||||
"error_code: {}, reason_code: {}\n", ec.message(), rc.message()
|
||||
);
|
||||
std::cout << "error_code: " << ec.message() << std::endl;
|
||||
std::cout << "reason_code: " << rc.message() << std::endl;
|
||||
c.cancel();
|
||||
}
|
||||
);
|
||||
@@ -177,6 +176,7 @@ void publish_qos2_websocket_tls() {
|
||||
|
||||
|
||||
void subscribe_and_receive_websocket_tls(int num_receive) {
|
||||
std::cout << "[Test-subscribe-and-receive-websocket-tls]" << std::endl;
|
||||
using namespace async_mqtt5;
|
||||
asio::io_context ioc;
|
||||
|
||||
@@ -212,10 +212,8 @@ void subscribe_and_receive_websocket_tls(int num_receive) {
|
||||
[](error_code ec, std::vector<reason_code> codes, suback_props) {
|
||||
if (ec == asio::error::operation_aborted)
|
||||
return;
|
||||
fmt::print(
|
||||
"[Test-subscribe-and-receive-websocket-tls] "
|
||||
" error_code: {}, reason_code: {}\n", ec.message(), codes[0].message()
|
||||
);
|
||||
std::cout << "subscribe error_code: " << ec.message() << std::endl;
|
||||
std::cout << "subscribe reason_code: " << codes[0].message() << std::endl;
|
||||
}
|
||||
);
|
||||
|
||||
@@ -227,11 +225,10 @@ void subscribe_and_receive_websocket_tls(int num_receive) {
|
||||
) {
|
||||
if (ec == asio::error::operation_aborted)
|
||||
return;
|
||||
fmt::print(
|
||||
"[Test-subscribe-and-receive-websocket-tls] message {}/{}:"
|
||||
"ec: {}, topic: {}, payload: {}\n",
|
||||
i + 1, num_receive, ec.message(), topic, payload
|
||||
);
|
||||
std::cout << "message " << i + 1 << "/" << num_receive << std::endl;
|
||||
std::cout << "error_code: " << ec.message() << std::endl;
|
||||
std::cout << "topic: " << topic << std::endl;
|
||||
std::cout << "payload: " << payload << std::endl;
|
||||
|
||||
if (i == num_receive - 1)
|
||||
c.cancel();
|
||||
|
||||
Reference in new issue
Block a user