Category : mqtt

So, I am currently writing code for a MQTT C++ application and would like to have some feedback concerning the general architecture. I am planning to write an application that employs a single-mqtt client that is controlled via events from the outside. It publishes logging events and states to the outside world, either in a ..

Read more

I want to compile the samples of paho.mqtt.cpp but I cannot seem to compile them. When i run cmake paho.mqtt.cpp/src/samples it gives me the error u see in the title and here under: “`/usr/bin/ld: CMakeFiles/ws_publish.dir/ws_publish.o: in function `main’: ws_publish.cpp:(.text+0x1e8): undefined reference to `mqtt::async_client::async_client(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, mqtt::iclient_persistence*)’ /usr/bin/ld: ws_publish.cpp:(.text+0x2f8): ..

Read more

Im following these steps to install Paho MQTT library for cpp: sudo apt-get install build-essential gcc make cmake cmake-gui cmake-curses-gui git doxygen graphviz libssl-dev git clone https://github.com/eclipse/paho.mqtt.c.git cd paho.mqtt.c git checkout v1.2.1 (tried v1.3.8 and v1.3.1) cmake -Bbuild -H. -DPAHO_WITH_SSL=ON sudo cmake –build build/ –target install sudo ldconfig cd .. git clone https://github.com/eclipse/paho.mqtt.cpp cd paho.mqtt.cpp ..

Read more

I’m compiling an Arduino example with version 2.5.0 of this MQTT library: #include <ESP8266WiFi.h> #include <MQTT.h> class MyClass { public: void connect(); void loop(); void messageReceived(MQTTClient *mqttClient, char[], char[], int); WiFiClient net; MQTTClient mqttClient; unsigned long lastMillis = 0; }; void MyClass::connect() { if (WiFi.status() != WL_CONNECTED) { Serial.print("checking wifi…"); } while (WiFi.status() != WL_CONNECTED) ..

Read more

I create a project to receive message from MQTT. My full code is here https://github.com/kamshory/OTP-Mini/blob/main/Server/Server.ino WiFiClient espClient; PubSubClient client(espClient); void setup() { char * mqttServer = "192.168.1.3"; client.setServer(mqttServer, 1883); client.setCallback(mqttCallback); } void mqttCallback(const char* topic, byte* payload, unsigned int length) { Serial.print("Message arrived on topic: "); Serial.print(topic); Serial.print("Message: "); char * mqttTopic = "sms"; String ..

Read more