IoT hub mqtt send device to device msg

Mahammed Javed Akhtar 0 Reputation points
2024-09-21T09:42:32.3466667+00:00

can any one tell me why my mqtt is getting disconnected when i am trying to publish a device bound message

it will be very much help full if anyone can tell the correct topic name and msg format to send msg from one device to another using mqtt

Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,195 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sander van de Velde | MVP 32,726 Reputation points MVP
    2024-09-21T12:15:26.38+00:00

    Hello @Mahammed Javed Akhtar,

    welcome to this moderated Azure community forum.

    It's hard to say what error you encounter without detailed information.

    Check out this blog post regarding the MQTT topic support by the IoT Hub (code demonstrated is found on GitHub).

    The message topic looks like:

    $"devices/{_clientId}/messages/events/";

    where the clientId is the deviceId.

    This message can be extended with user properties (as seen in the example).

    Please compare the full example (including making the connection) with your code.

    It is recommended to use the Azure IoT Hub device SDK where possible. It simplifies the logic, adds error handling, and hides complexity.


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.