Hi all, I am trying to publish an mqtt message using Qt QML following this example: https://doc.qt.io/QtMQTT/qtmqtt-quicksubscription-example.html
However, this example only shows how to subscribe to topics while I want to publish. I tried to call "publish" from QML like can see in code below but nothing is sent while console.log shows a -1. Any thoughts what I am doing wrong? Or does someone has an example? I can see in my broker log that a connection is made successfully. MqttClient { id: mqttclient port: 1883 hostname: "localhost" } Button { id: connect text: qsTr("Connect") onClicked: { console.log(mqttclient.connectToHost()) } } Button { id: publish text: qsTr("publish") onClicked: { console.log(mqttclient.publish("mytopic","mytestmessage")) } } Thanks!
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest