【发布时间】:2018-07-03 17:22:38
【问题描述】:
我使用 python 和 paho.mqtt 将消息发送到云端 我设置了端点和路由。当我将查询字符串设置为 true 时,一切正常
messageDict = {}
systemPropertiesDict = {"contentType": "application/json", "contentEncoding": "utf-8", "iothub-message-source": "deviceMessages", "iothub-enqueuedtime": "2017-05-08T18:55:31.8514657Z"}
messageDict = {"systemProperties": systemPropertiesDict}
messageDict["appProperties"] = {}
body = '{id:1}'
messageDict["body"] = body
root = {"message":messageDict}
msg = json.dumps(root, indent=2).encode('utf-8')
print("Message to send", msg)
self.client.publish(topicName, msg)
但是如果我将查询字符串设置为$body.id = 1,那么我就不会收到任何消息。
有什么想法吗,伙计们?
【问题讨论】:
-
你好放大器,你可以试试答案的解决方案,看看它是否有效。它对我有用。
标签: python azure mqtt azure-iot-hub