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. how can I read QDataStream from mqtt with nodeJs
Forum Updated to NodeBB v4.3 + New Features

how can I read QDataStream from mqtt with nodeJs

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 597 Views 1 Watching
  • 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.
  • R Offline
    R Offline
    RahibeMeryem
    wrote on 22 Nov 2018, 12:40 last edited by
    #1

    I have below data stream :

    struct dataLoad {
            QString text;
            QImage image;
        };
    
    Sending it to the mqtt broker.
    

    How can I read it from nodejs client as string and png ?

    var mqtt = require('mqtt')
    //var client  = mqtt.connect('mqtt://ps01.insightradar.com', username="murat" , password="murat1990" , clientId="nodeJS")
    var client = mqtt.connect('mqtts://pxxs01mm.com', {
        username: 'admin',
        password: 'xx',
        rejectUnauthorized: false
    });
    client.on('connect', function () {
      client.subscribe('qtmqtt/topic1', function (err) {
        if (!err) {
          client.publish('result/light', 'Hello mqtt')
        }
      })
    })
    
    client.on('message', function (topic, message) {
      // message is Buffer
        
      console.log(message.toString())
      
    })
    
    
    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 22 Nov 2018, 21:39 last edited by
      #2

      Hi,

      Why a nodejs client ?

      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
      0
      • R Offline
        R Offline
        RahibeMeryem
        wrote on 23 Nov 2018, 13:51 last edited by
        #3

        I found its easy to send my client to use.. What will be the your sugeestion ? Python?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 23 Nov 2018, 20:40 last edited by
          #4

          If you already use Qt why not continue with it ?

          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
          0

          1/4

          22 Nov 2018, 12:40

          • Login

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