This repo contains code for a web application, which can read several data from IoT hub and show the real-time data in a line chart on the web page.
The code is based on https://github.com/Azure-Samples/web-apps-node-iot-hub-data-visualization
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 need a B&R SiteManager to collect field data from your machines and send them to the IoT Hub! See B&R Website for further information!
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.ConnectionString
andAzure.IoT.IoTHub.ConsumerGroup
toApp settings
slot. - Go to
Deployment options
, selectGithub repository
to deploy your web app. - Go to
Deployment credentials
, set your deploy username and password. - In the
Overview
page, note theGitHub project
URL. - The code will then be synchronized to your WebApp
- You can now 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