我有一个数据结构
struct dataLoad {
QString text;
QImage image;
};
将其发送到mqtt代理,并希望从nodejs中读取
var mqtt = require('mqtt')
//var client = mqtt.connect('mqtt://ps01.insightradar.com', username="murat" , password="murat1990" , clientId="nodeJS")
var client = mqtt.connect('mqtts://ps.xx.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("mesaj geldi")
console.log(message.toString())
})
我可以接收Qdatastream有效负载。如何解码文字和图片(图片为PNG)
谢谢