From a87cb1b12e29276c57c61059825d0ce4c810c9f7 Mon Sep 17 00:00:00 2001 From: "ishak jmilou.ishak" Date: Mon, 21 Oct 2024 11:12:04 +0200 Subject: [PATCH] added username and password --- src/C++/Socket/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/C++/Socket/main.cpp b/src/C++/Socket/main.cpp index f44e437..0d92b7b 100644 --- a/src/C++/Socket/main.cpp +++ b/src/C++/Socket/main.cpp @@ -1,5 +1,6 @@ #include #include +#include const std::string ADDRESS("tcp://localhost:1883"); // Brokeradres (Raspberry Pi) const std::string CLIENT_ID("cpp_subscriber"); @@ -14,10 +15,13 @@ class callback : public virtual mqtt::callback { }; int main() { - + mqtt::async_client client(ADDRESS, CLIENT_ID); callback cb; client.set_callback(cb); + client.set_user_name("ishak"); + client.set_password("kobuki"); + try { std::cout << "Verbinden met broker..." << std::endl;