Web-based Azure IoT Hub Developer Tool


点击此处查看中文版本

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.

Azure Portal

Azure Portal

Connect

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.

MQTT connection options

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.

Send D2C Message

In C2D Message tab, you can see messages sent from cloud.

Receive cloud message

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.

Add method

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.

Call direct method

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.

Device twin

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.

Update device twin

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.

Comments (5)

  1. Sultan Pi says:

    I have tried with Edge and Firefox and I get this error:
    AMQJS0008I Socket closed

    1. Hi Sultan, thanks for your feedback! I’ve tested Edge and Firefox on my side, and both of them work fine. Here are some screenshots:

      Edge: https://msdnshared.blob.core.windows.net/media/2017/03/edge.png
      Firefox: https://msdnshared.blob.core.windows.net/media/2017/03/ff.png
      My Windows 10 version: https://msdnshared.blob.core.windows.net/media/2017/03/win10.png

      Can you tell me more details about your side?

      Also, as I said in Why not working in Chrome section, IoT Hub server really has some wired behavior, and maybe you have to use a man-in-the-middle tool to solve such issue currently.

    2. BTW, please confirm there’s no other devices connect to IoT Hub with the same device connection string.

  2. Sultan Pi says:

    Hi, many thanks for your prompt response! I just created a new device and it works. thanks for your support!

  3. Sheng Chen says:

    Amazing job!

Skip to main content