Azure IoT published Device Explorer to make it easy to send and receive IoT Hub messages, however, Device Explorer can run on Windows only.
We have developed a web based tool for Azure IoT Hub, and you can send and receive IoT Hub messages in browser without installing anything.
With some limitation, it cannot work in Chrome currently [why?], however, you can use a man-in-the-middle tool to fix this issue, such as Fiddler. This tool can work in Chrome correctly now.
To use this tool, visit https://azure-iothub.github.io/v2/ in your browser, paste your Device Connection String to the box and click Connect button. You can find the device connection string from Azure portal.
If you would like to connect to IoT Hub using MQTT over WebSockets, switch Show MQTT over WebSockets connection options on, and you will see MQTT connection options. If you don't know what MQTT is, and want to use IoT Hub SDK instead, just forget it.
After connected, switch to D2C Messages tab. You can send anything, including JSON, XML and plaintext. Just type anything in the box, and click send button. If your server is listening IoT Hub, it should receive the message you just sent. Also, switch MQTT options on if you need.
In C2D Message tab, you can see messages sent from cloud.
Direct methods is a useful feature for communications that require immediate confirmation of their result, usually interactive control of the device, for example to turn on a fan. You can learn more about IoT Hub direct methods from https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-direct-methods.
To use direct method, switch to Direct Methods tab. You need add a new method listener on device side to listen specific method called by the cloud. Click Add a method listener, input the method name, for example, reboot, which means when the cloud calls reboot method, the device will be mentioned. Response payload is the device response body, it will be received by the cloud as callback in call direct method function. Status code is also a part of device response, which is usually 204 when there's no payload sent. The response delay is a network latency simulation, the payload will be sent after the specific delay.
Notice, if you use Device Explorer to call direct method, you must use JSON formatted response payload, or Device Explorer may give an error message.
Device twins are JSON documents that store device state information, you can learn more about device twins from https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-device-twins.
To get or send device twin, switch to Device Twin tab.
You can see Desired Properties and Reported Properties. Desired Properties is managed by the cloud, it will update automatically on the page. Reported Properties is managed by devices. If you want to update Reported Properties, write a JSON format string in Send Reported Properties to Cloud box. You needn't write the entire device twin, but just write properties need update.
If you have a feedback, please send it to https://github.com/azure-iothub/v2/issues.
Why not working in Chrome
For unknown reason, IoT Hub requires the client a certification for authentication, even if you use a key to connect to IoT Hub rather than an X.509 cert, however, IoT Hub doesn't verify the required certification at all. When Chrome finds the server require a not-found certification, it aborts the connection. Other browsers may try to connect to the server without the required certification.
This tool can work in Chrome correctly after we change endpoint from wss://<iothubname>.azure-devices.net/$iothub/websocket to wss://<iothubname>.azure-devices.net/$iothub/websocket?iothub-no-client-cert=true.