Azure主题并通过MQTT发送消息 [英] Azure topic and sending message over MQTT
问题描述
是否可以通过mqtt将消息发送给天蓝色的任何自定义主题.到目前为止,我发现的所有示例都适用于标准主题
Is it possible to send messages to azure to any custom topic via mqtt. All example that I've found so far work with standard topics
'devices/' + hubName + '/messages/events/'
'devices/' + hubName + '/messages/devicebound/#'
顺便说一句,尽管连接成功,我还是尝试通过MQTT.fx应用程序发送/订阅上面的主题/订阅,并且从未收到消息.
Btw, I tried to send/subscribe on the topic/subscription above with MQTT.fx application and never received messages, although the connection was successful.
推荐答案
devices/{device_id}/messages/devicebound/#
的主题过滤器是订阅从IoT中心接收消息(云到设备消息),它认为您需要了解以下区别:来自此处.
devices/{device_id}/messages/events/
的主题是用于从设备发送设备到云的消息.
The topic filter of devices/{device_id}/messages/devicebound/#
is to subscribe receiving message from IoT Hub(Cloud-To-Device message), it think you need to understand the difference about device-to-cloud message and cloud-to-device message from here.
The topic of devices/{device_id}/messages/events/
is for sending a device-to-cloud message from device.
您可以使用设备浏览器测试这个问题.当您使用该工具向设备发送消息时,MQTT.fx将收到消息.
You can use Device Explorer to test this issue. When you send a message to device with the tool, MQTT.fx will receive the message.
这篇关于Azure主题并通过MQTT发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!