amenzhinsky / iothub

Azure IoT Hub SDK for Golang
MIT License
53 stars 57 forks source link

Device Module Topic name incorrect for receiving events #46

Closed mikebarber1 closed 2 years ago

mikebarber1 commented 3 years ago

When Cloud To Device Module events are sent they are not received by the device module.

https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-mqtt-support

Connecting to IoT Hub over MQTT using a module identity is similar to the device (described in the section on using the MQTT protocol directly as a device) but you need to use the following:

Set the client ID to  {device_id}/{module_id}.
.......

Using this as the guide I changed the topic name for modules subscribing to events to match that of the Device except including /{module_id} and I began receiving messages sent to the device module.

Note: I am not using an Edge Gateway, I am not sure how that might affect the Topic name used if it was.