Azure topic and sending message over MQTT

2019-08-17 07:41发布

问题:

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/#'

Btw, I tried to send/subscribe on the topic/subscription above with MQTT.fx application and never received messages, although the connection was successful.

回答1:

Did you have a look on these ??

Azure IoT Hub - Send message (C2D) to one device on 2 topics instead of devicebound/#

Can I send a message to a group of Azure IoT Hub Devices connected via MQTT WebSocket?

https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-c2d-guidance



回答2:

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.

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.