-
Type:
Bug
-
Status: Closed
-
Priority:
P3: Somewhat important
-
Resolution: Done
-
Affects Version/s: 5.11.0
-
Fix Version/s: 5.11.2, 5.12.0 Alpha
-
Component/s: MQTT
-
Labels:None
-
Platform/s:
-
Commits:e023d5638bb29bb0c9b1b94ec4dde57d4b6af5ed
When adding the publish method to main.qml in example: https://doc.qt.io/QtMQTT/qtmqtt-quicksubscription-example.html, a -1 (error) is returned.
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"))
}
}
As suggested by Maurice Kalinowsky, this is mostly caused by a failing auto-conversion from QString to QMqttTopicName.