About | Features | Technologies | Requirements | Starting | License | Author
This repository contains a simple C++ program that demonstrates how to publish messages to an MQTT broker using the Paho MQTT C client library. The program establishes a connection to the MQTT broker, publishes a "Hello World!" message to a specified topic, and then disconnects.
✔️ CMake file for testing the paho MQTT in Ubuntu;
✔️ Testing the Paho library;
The following tools were used in this project:
Before starting 🏁, you need to have Mosquitto and Cmake installed.
To installed the Paho make sure you are using cmake to build.
# Clone this library
$ git clone https://github.com/eclipse/paho.mqtt.c.git
# Access
$ cd paho.mqtt.c
# Making the files
$ cmake -Bbuild -H. -DPAHO_BUILD_STATIC=on -DPAHO_WITH_SSL=off
# Install the Paho MQTT
$ sudo cmake --build build/ --target install
# Clone this project
$ git clone https://github.com/AlirezaBeigiMech/paho_simple_mqtt.git
# running and setting up Cmake from CmakeList
$ cmake ..
# Building the files
$ cmake --build .
# Run the subescriber in Ubuntu
$ mosquitto_sub -h localhost -p 1883 -t "MQTTExamples"
# The server will initialize in the <http://localhost:1883>
# Run the c project
$ ./MQTTExample
# You should watch the result of MQTT communication.
This project is under license from MIT. For more details, see the LICENSE file.
Made with ❤️ by Alireza Beigi