Skip to content

AlirezaBeigiMech/paho_simple_mqtt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Paho MQTT Demo

Github top language Github language count Repository size License

About   |   Features   |   Technologies   |   Requirements   |   Starting   |   License   |   Author


🎯 About

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.

✨ Features

✔️ CMake file for testing the paho MQTT in Ubuntu;
✔️ Testing the Paho library;

🚀 Technologies

The following tools were used in this project:

✅ Requirements

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

🏁 Starting

# 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.

📝 License

This project is under license from MIT. For more details, see the LICENSE file.

Made with ❤️ by Alireza Beigi

 

Back to top