Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lecrapouille/mqtt
[Lib][Version 0.2.0][Functional] MQTT Client (wrapper on the mosquitto lib)
https://github.com/lecrapouille/mqtt
mosquitto mqtt mqtt-client
Last synced: 3 days ago
JSON representation
[Lib][Version 0.2.0][Functional] MQTT Client (wrapper on the mosquitto lib)
- Host: GitHub
- URL: https://github.com/lecrapouille/mqtt
- Owner: Lecrapouille
- License: mit
- Created: 2023-04-23T20:20:55.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-07-17T22:31:04.000Z (4 months ago)
- Last Synced: 2024-10-11T11:13:00.240Z (27 days ago)
- Topics: mosquitto, mqtt, mqtt-client
- Language: C++
- Homepage:
- Size: 27.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: LICENSE
Awesome Lists containing this project
README
# MQTT: Class wrapping MQTT mosquitto
A C++11 tiny wrapper class for a MQTT client based on the mosquitto implementation.
You will need small code to make your application running with a MQTT client.- See https://github.com/eclipse/mosquitto
- See https://www.howtoforge.com/how-to-install-mosquitto-mqtt-message-broker-on-debian-11/## Hello World example
- In a first Linux console, a subscriber will echo messages from our application. Type:
```
mosquitto_sub -h localhost -t "Output"
```- In a second Linux console, compile and launch our application. Type:
```
cd example
g++ --std=c++11 -Wall -Wextra -I../include ../src/MQTT.cpp Example.cpp -o example `pkg-config --cflags --libs libmosquitto`
./example
```You will see (may be different from your case):
```
Connected to MQTT broker with error code 0
Topic 1 subscribed. Granted QOS: 0
```- In a third Linux console, a publisher will send messages to our application. Type:
```
mosquitto_pub -h localhost -t "Input" -m "Hello"
```You will see:
- In the first console:
```
Hello back
```- In the second console:
```
Received message 0: "Hello" from topic: "Input" size: 5 qos: 0
Message 2 published
```Your C++ asynchronous MQTT client is functional :)