mirror of
https://gitlab.fdmci.hva.nl/technische-informatica-sm3/ti-projectten/rooziinuubii79.git
synced 2025-08-04 04:14:58 +00:00
added username and password
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <mqtt/async_client.h>
|
#include <mqtt/async_client.h>
|
||||||
|
#include <paho-mqtt/MQTTAsync.h>
|
||||||
|
|
||||||
const std::string ADDRESS("tcp://localhost:1883"); // Brokeradres (Raspberry Pi)
|
const std::string ADDRESS("tcp://localhost:1883"); // Brokeradres (Raspberry Pi)
|
||||||
const std::string CLIENT_ID("cpp_subscriber");
|
const std::string CLIENT_ID("cpp_subscriber");
|
||||||
@@ -18,6 +19,9 @@ int main() {
|
|||||||
mqtt::async_client client(ADDRESS, CLIENT_ID);
|
mqtt::async_client client(ADDRESS, CLIENT_ID);
|
||||||
callback cb;
|
callback cb;
|
||||||
client.set_callback(cb);
|
client.set_callback(cb);
|
||||||
|
client.set_user_name("ishak");
|
||||||
|
client.set_password("kobuki");
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
std::cout << "Verbinden met broker..." << std::endl;
|
std::cout << "Verbinden met broker..." << std::endl;
|
||||||
|
Reference in New Issue
Block a user