Exercise 3: Connecting a Device
In the following example, you will learn how to connect your virtual device to Azure IoT Hub and provide telemetry streaming. Because a real device is difficult to set up and configure, we will use a virtual algorithm that works in a browser and mimics the communication between an IoT device and an IoT Hub. The algorithm is represented by JavaScript code that can be modified:
- Open this link: https://azure-samples.github.io/raspberry-pi-web-simulator/.
- Replace the value of
connectionString
in line 15 with the connection string from the previous exercise. Use a single quote forconnectionString
. You can safely change the code with any updates you want. The script will be executed in your browser and will not affect others or any applications you run in parallel. - Once you have replaced the connection string, you can hit the Run button on the gray output console to start the telemetry stream. The JavaScript code will start producing messages...