Visualizing Azure IoT Edge using local dashboard

In my last series of blogs, we first looked at how to deploy a non-IoT Edge module using Azure IoT Edge.

For this example, I used a NodeJS website running SocketIO. It was possible to access this website with a default SocketIO chat application.

After that, we looked at how to add some charts in the HTML page offered by the NodeJS server.

Let’s see how we can combine this all into one solution. Let’s build a local for raw Azure IoT Edge telemetry.

Continue reading “Visualizing Azure IoT Edge using local dashboard”

Advertenties

Show telemetry in NodeJS using SocketIO and HighCharts

In my previous blog, I showed you how to host NodeJS in a Docker Image.

Today we will learn how we show telemetry in NodeJS. The message will arrive as a string on an HTML page using SocketIO and we will put it on a chart from HighCharts.

This is a great example of how we can represent raw data in something useful, something end user will understand.

We will extend our previous example. In that example, we were leaning on NodeJS and we have the Express web framework running to show an HTML page. We added SocketIO so users of the index.html can exchange messages.

But what if the incoming message is

{
  "machine":{
    "temperature":21.810507137356563
  },
  "timeCreated":"2018-01-06T23:55:56.1058921Z"
}

a JSON message on a single line? And it is shown as a string?

Nice, but this is only good for nerds like me.

What if we could represent it as:

a chart?

This a much better solution, isn’t it?

Continue reading “Show telemetry in NodeJS using SocketIO and HighCharts”

Deploying a NodeJS server with SocketIO to Docker using Azure IoT Edge

The current Azure IoT Edge public preview uses Docker to deploy logic from the cloud into local gateways. It’s currently featuring:

  • C# modules written in .Net standard
  • Python modules
  • Azure Function built on your machine
  • Azure Stream Analytics jobs built and deployed in the cloud
  • Azure Machine Learning

We can expect Microsoft will support other types of modules soon as they have proven with other recent projects. An Azure Cognitive Services module is a good example, it’s put in every IoT Edge presentation.

The IoT Edge portal makes it possible to deploy modules which are available in private or public image repositories.

Could it be possible to build and deploy images to the gateway which are not specifically designed for IoT Edge?

It turns out, it is possible.

Let’s deploy a NodeJS server which serves SocketIO.

Continue reading “Deploying a NodeJS server with SocketIO to Docker using Azure IoT Edge”

Part 3: Adding Basic Authentication to Asp.Net Core the right way

This blog is all about adding Basic Authentication to Asp.Net Core.

Warning: Although implementing Basic Authentication seems easy, it brings a vulnerability to your site! names and passwords provided are sent over the internet unencrypted. This means: the authentication method does not hide the name and password for hackers. You have to encrypt the communication yourself! Therefore, always combine Basic Authentication with SSL, also known as HTTPS.

In the past, I have written my own simple Basic Authentication NuGet package. It’s still ok for simple classic Asp.Net MVC projects.

But I want to use Basic Authentication In Asp.Net Core. Instead of (re)writing my own NuGet package, I checked out the NuGet store and found a nice solution.

This NuGet package provides me the flexibility to add Basic Authentication to my (test) projects.

In this blog, we will see what we have to do to get it running. And we will see how we can beef up the security by using HTTPS.

Continue reading “Part 3: Adding Basic Authentication to Asp.Net Core the right way”

Part 2: Passing data from outside an Asp.Net MVC Core site to the browser using SignalR

In my last blog, I show how you can implement SignalR on a website running Asp.Net MVC Core. Although the libraries are still in Alpha, the functionality looks very promising.

In this blog, I will show you how you can pass data on to the website so it can be shown in the browser. Users will ‘instantly’ see updates coming on the website.

Let’s check this out.

Continue reading “Part 2: Passing data from outside an Asp.Net MVC Core site to the browser using SignalR”

Part 1: Getting SignalR running on Asp.Net MVC Core

Microsoft has a very powerful implementation of WebSockets available named SignalR. Personally, I like the fact it automatically scales down if needed to other communication solutions if WebSockets is not working (like long polling).

I used it in the past several times for dashboards but in my current project, I had a new challenge. We are using Asp.Net MVC Core. This is ‘the latest’ flavor of Asp.Net and our websites can now run on both Windows and Linux.

But Asp.Net MVC Core has broken with the past, which is a good thing but it also needs a different way to activate SignalR.

Microsoft has provided documentation but it was written towards the standard, non-MVC applications.

It took me a while to get SignalR running.

But first, let me introduce you to the steps to be taken to get SignalR running on Asp.Net MVC Core. Continue reading “Part 1: Getting SignalR running on Asp.Net MVC Core”

Zip and unzip a string of data in memory

I was looking for a way to zip and unzip a file.

Normally, this is not really an issue. There are lots of libraries and NuGet packages available.

But this file was represented to me as a string, some JSON, actually.

So I was looking for a way to convert a string into some zipped format and back. This was harder than expected.

In the end, I wrote a solution myself. Here it is for you to use it, just to save you a lot of time.

Note: This library is available on GitHub. And Visual Studio users can import the NuGet package.

Continue reading “Zip and unzip a string of data in memory”