This repo contains code for a web application, which can read temperature & humidity data from IoT hub and show the real-time data in a line chart on the web page.
| Browser | Least Version |
|---|---|
| IE | 10 |
| Edge | 14 |
| Firefox | 50 |
| Chrome | 49 |
| Safari | 10 |
| Opera | 43 |
| iOS Safari | 9.3 |
| Opera Mini | ALL |
| Android Browser | 4.3 |
| Chrome for Android | 56 |
You can refer the related lesson to run an daemon application, to send data to your IoT hub.
Go to Azure Portal and select your IoT hub. Click Endpoints -> Events, add a new consumer group and then save it.
Go to Azure Portal to create your own Azure web app service. Then do the following setting:
- Go to
Application settings, add key/value pairsAzure.IoT.IoTHub.ConnectionStringandAzure.IoT.IoTHub.ConsumerGrouptoApp settingsslot. - Go to
Deployment options, setLocal git repositoryto deploy your web app. - Go to
Deployment credentials, set your deploy username and password. - In the
Overviewpage, note theGit clone url. - Push the repo's code to the git repo url you note in last step.
- After the push and deploy finished, you can view the page to see the real-time data chart.
-
Open a console and set the following environment variable:
set Azure.IoT.IoTHub.ConnectionString=<your connection string>set Azure.IoT.IoTHub.ConsumerGroup=<your consumer group name>
-
Open ./public/javascripts/index.js, and change the code around line 69
from
var ws = new WebSocket('wss://' + location.host);
to
var ws = new WebSocket('ws://' + location.host);
-
npm install -
npm start