Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. MQTT- How to implement it, with Qt?
Forum Update on Monday, May 27th 2025

MQTT- How to implement it, with Qt?

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 5 Posters 12.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Muzab
    wrote on 30 Apr 2016, 14:14 last edited by
    #1

    Can someone point me to Qt or any external resources|example to implement MQTT Publisher, Broker, Subscriber.
    Thanks!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 30 Apr 2016, 14:30 last edited by
      #2

      Hi
      Maybe you can use an existing client ?
      https://github.com/emqtt/qmqtt

      1 Reply Last reply
      1
      • Y Offline
        Y Offline
        yuvaram
        wrote on 30 Apr 2016, 14:32 last edited by
        #3

        Hi @Muzab
        MQTT implementation is provided through C++ classes, So all its possible to implement it.
        Here is sample code [link MQTT](link https://github.com/eclipse/mosquitto).
        If not i can share other sample code.

        Yuvaram Aligeti
        Embedded Qt Developer
        : )

        1 Reply Last reply
        3
        • M Offline
          M Offline
          Muzab
          wrote on 30 Apr 2016, 15:31 last edited by
          #4

          @mrjj

          This is the first time I am using a git project to be added into the library. Unfortunately! it does'nt work if I just compile it or run it.

          I cannot import

          #include <qmqtt.h>
          

          Can you tell me what more is to be done here ? Thanks!

          1 Reply Last reply
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 30 Apr 2016, 20:27 last edited by
            #5

            Hi,

            If you are using Qt Creator then you can use the technique described here

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1
            • M Offline
              M Offline
              Muzab
              wrote on 2 May 2016, 08:02 last edited by
              #6

              @SGaist :
              Thanks!

              1 Reply Last reply
              1
              • D Offline
                D Offline
                DoNgocTuan
                wrote on 14 Oct 2016, 09:25 last edited by
                #7

                Hi, Muzab. Did you fix this problem, can you show me how please? i'm new to qmqtt and have the same problem.

                1 Reply Last reply
                0
                • Y Offline
                  Y Offline
                  yuvaram
                  wrote on 19 Oct 2016, 07:09 last edited by yuvaram
                  #8

                  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.

                  1. 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-dev

                  3.Now go to the mosquitto-1.4.2 directory:

                  Run the following Commands:

                  $ make all
                  $ sudo make install
                  $ sudo ldconfig

                  4.Now Mosquitto
                  o has Sucessfully compiled and

                  Include Path : /usr/local/include
                  Library Path : /usr/local/lib
                  Binary Path : /usr/local/bin

                  In bin you will have the following Binaries:
                  mosquitto_passwd mosquitto_pub mosquitto_sub

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

                  Yuvaram Aligeti
                  Embedded Qt Developer
                  : )

                  1 Reply Last reply
                  2
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 19 Oct 2016, 07:43 last edited by
                    #9

                    @yuvaram Sure there is: qmqtt from the Erlang MQTT project.

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    3
                    • Y Offline
                      Y Offline
                      yuvaram
                      wrote on 19 Oct 2016, 10:33 last edited by
                      #10

                      thank you @SGaist

                      Yuvaram Aligeti
                      Embedded Qt Developer
                      : )

                      1 Reply Last reply
                      1

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved