MQTT- How to implement it, with Qt?
-
Hi
Maybe you can use an existing client ?
https://github.com/emqtt/qmqtt -
Hi, Muzab. Did you fix this problem, can you show me how please? i'm new to qmqtt and have the same problem.
-
Hi @DoNgocTuan
There is nothing like QMQTT , mqtt is a opensource , can be cross compiled and can be added as external library.Steps to Compile,Configre,Run,Test the Mosquitto MQTT Broker.
- Download the Mosquitto MQTT Broker Source code from the following URL and Extract it:
$ wget http://mosquitto.org/files/source/mosquitto-1.4.2.tar.gz
$ tar -xvf mosquitto-1.4.2.tar.gz
2.Install the Dependency Libraries:
sudo apt-get install libssl-dev libwrap0-dev libc-ares-dev uuid-dev3.Now go to the mosquitto-1.4.2 directory:
Run the following Commands:
$ make all
$ sudo make install
$ sudo ldconfig4.Now Mosquitto
o has Sucessfully compiled andInclude Path : /usr/local/include
Library Path : /usr/local/lib
Binary Path : /usr/local/binIn bin you will have the following Binaries:
mosquitto_passwd mosquitto_pub mosquitto_sub5.Now start the mosquitto broker
$ mosquitto
1437720047: mosquitto version 1.4.2 (build date 2015-07-24 12:04:19+0530) starting
1437720047: Using default config.
1437720047: Opening ipv4 listen socket on port 1883.
1437720047: Opening ipv6 listen socket on port 1883.6.Test the mosquitto broker.
Open two terminal windows. In the first terminal run
$ mosquitto_sub -h 127.0.0.1 -t myTopic
In the second terminal run
$ mosquitto_pub -h 127.0.0.1 -t myTopic -m "My first message"
At this point, on the first terminal you should have received the message “My first message”
7.Now test the Qt Application by Runing Respective Binaries.
First run ./MosquittoSubscribe and subscribe to a topic.
Now Run ./MosquittoPublish and Publish to same topic. - Download the Mosquitto MQTT Broker Source code from the following URL and Extract it: