Let’s first understand what is SignalR?
In simple words I will say “SignalR is an Abstraction that intelligently decides how to enable real time over HTTP.” SignalR can figure out what a server and client can do. It provides you the capability to actually establish a persistent connection between client and server and lets server communicate with client seamlessly. AJAX allows us to send a request (relatively very small) and update the UI based on the response. Challenges we face include the different behavior of browsers in terms of features and support. From a performance point of view, the server’s resource and network utilization are other issues, so we can’t blindly send multiple requests to the server. Similarly we can’t make the user wait more while waiting for the update. It’s developer’s responsibility to use the best available option/protocol for handling real-time communication.SignalR is one of the best way for real-time communication.
I will be bad blogger if I just keep on writing about SignalR without any practical code on this so let me start with creating a small application “Hitcounter” You might have done this many a times before in simple javascript. In this we will get the active users on the site.
Follow these steps
- Open VS2015, create new Web Application named “HitCounter” .
- Click manage Nuget package for installing SignalR.

You can see there are many packages available for SignalR.SignalR guys have divided the component into small package.We will install asp.net SignalR.
- J just click I Accept and procced.

- Once SignalR installed, ReadMe file will popup. It has all the stuff that will help to create the application using SignalR.

- Now we have to add OWIN StartUP Class name it “Startup.cs”. The easiest way to wire up SignalR for our scenario is to use the Microsoft ASP.NET SignalR OWIN Nuget Package. OWIN gives us an easy way to inject functionality into our server. The Startup class provides the entry point for an application, and is required for all applications. It’s possible to have environment-specific startup classes and methods (see Working with Multiple Environments), but regardless, one startup class will serve as the entry point for the application.

- Now add SignalR Hub Class named “HitCounterHub”. A hub is just a regular class that inherits from Hub. Just keep in mind that hubs are transient, meaning that anything you store in a member property will be lost in the next call. That's actually a good thing since we may be spanning multiple servers. Storing any state should happen outside of the hub.

- See the below Image, I have added the line










Satish Kumar VadlavalliPosted Oct 18, 2016, 8:55 AM
Good article, keep up good work
Humayun Kabir MamunPosted Oct 13, 2016, 3:57 AM
Nice...