Introduction

SignalR is described as “Incredibly simple real-time web for .NET”.

It’s a great way for a JavaScript client to call directly into Server side methods, and a great way for the Server to push up updates or notifications to the JavaScript client.

We’re going to make a simple Visual Studio LightSwitch (LS) application here. And then we are going to use SignalR to push up some real-time notifications to the LightSwitch HTML Client.

We’ll end up with a LS HTML App that receives a notification every time a new entity is inserted or updated.

Description

My blog article, "ASP.NET SignalR and LightSwitch (VS 2012 Update 2, VS 2013 and later)!!!" has a lot more detail on this subject and a step by step walkthrough.

The code and project are made available here as well.

 

Building the Sample

This does require Visual Studio 2012 Update 2 (or later).

After you download the application, you can F5/Debug it to build and run it.

Your default web browser should launch with the LightSwitch HTML Client.

Go ahead and create a new Contact (click the "Add Contact" button in the bottom right of your HTML page) and Save it.  You should see something like this after you save.

image

This is cool…BUT try this with 2 browsers opened to really blow your mind.

So launch another instance of your web browser.

Copy and paste your http://localhost:NNNN/HTMLClient URL from your first browser into the second browser’s address bar.

Now create another record again. You’ll see this:

image

 

Both browsers got updated at the same time!

That’s pretty awesome, IMO.

So awesome, that I had to make a YouTube video for it:

http://youtu.be/FSEc0KeA1yE

Enjoy!