Learning ASP.NET SignalR – Part 1

Hello All,

Today I am going to discuss one of the new technologies that changed the way we used to think about How the web works. I’ll be writing a series on this technology and this post is first part of it.

You must have been working on the ASP.NET for long or might be since inception. And till date (or till this technology got introduced) , You got to know from every where that Web is stateless. A webpage is recreated every time from scratch it is posted back to server. In traditional web programming, all the information within the page and control gets wiped off on every postback.

I have taken the above lines from one of my post which I had written long back.

The web page used to work on PULL approach means you have to pull the data from the server. It means whenever you want to get some data from server, you require to send some request to server so that it can send the updated data along with the response. Remember, many times we required to update the UI as soon as the data gets updated to the server and then we used some polling method which keeps sending some request to server and checks if the data is updated and if yes, it refreshes the page or you have done something similar. So it works like


But things are changing rapidly. Web Sockets introduced in HTML5 provides us a capability to create a full duplex channel over web.

But SignalR provides an abstraction over persistent connection. It makes you tension free about the type of browser and web server versions.It works in a consistent way in all the environment.


Although all the latest web browsers supports the new technology WebSockets but this is not the case every time. Some of your user might be still using IE6/IE7 etc and you cannot simply say that I cannot support this. Ultimately this is buyer’s world. So you have to support as per your Client’s requirement and here SignalR wont let you down. So How does SignalR work on all the browsers? It actually checks the browser’s capability and accordingly takes the decision as

Technology Selection

So I think you all must have got an Idea the way SignalR works. but let’s try to dig into it. As you can see in the pic, it starts from top to bottom as if the environment supports Web Sockets else server sent event else forever frame else polling, means it has fall back one step further until your browser supports it.

So in simple words, What is ASP.NET SignalR?

We can say it is Real time – Means updates the web page Real time
Push Approach – Server pushes the data to all the connected Clients.

So let’s see How it works pictorially?


As you can see in the above pic the An event generator generates event and notifies to SignalR hub. Signal R Hub process it and forwards the the message to the appropriate Client(s).

You also can see that Client could be any like any .NET windows, web, console client, WP, Windows store apps, Android etc.  Similarly, event generator could be any Client initiates notification on some logic, database, any other server based on some logic. You can imagine the reach and simplicity of it. And I can assure you that it is very fast as well.

So what are the main components of ASP.NET SignalR?

  •     SignalR – A meta package that brings in SignalR.Server and SignalR.Js
  •     SignalR.Server – Server side components needed to build SignalR endpoints
  •     SignalR.Js – Javascript client for SignalR
  •     SignalR.Client – .NET client for SignalR
  •     SignalR.Ninject – Ninject dependeny resolver for SignalR

You can install SignalR via Nuget. I’ll let you know, How to install it.

First, let me tell you, that to work on it, you need to have either VS 2010 SP1 or VS 2012.

Then you can install SignalR via Nuget Packages using the following command. To install it ,

Open Visual Studio, Go to  Tools-> Library Package Manager -> Package Manager Console.  A console (Named as Package Manager Console) will be opened and run the following command

Install-Package Microsoft.AspNet.SignalR

You can also install the SignalR sample using the following NuGet package..

Install-Package Microsoft.AspNet.SignalR.Sample

Hope you all got have basic Idea about SignalR and the way it works. In my next post, I’ll be discussing one example and show, How does SignalR works on various browsers and environment?

Keep Learning,

7 thoughts on “Learning ASP.NET SignalR – Part 1

  1. Pingback: The South Asia MVP Blog

  2. can you pz tell me how can i use SignalR in Studio 2010. i have installed it but i cant found option to create hub?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s