Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

how can I read QDataStream from mqtt with nodeJs



  • 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())
      
    })
    
    

  • Lifetime Qt Champion

    Hi,

    Why a nodejs client ?



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


  • Lifetime Qt Champion

    If you already use Qt why not continue with it ?


Log in to reply