What is SignalR
We know very well how a client sends data to a server so now it's time to
understand how a server pushes data to a client in a HTTP connection. SignalR is
an open source library to add real-time web functionality in your ASP.Net web
application. So what does real-time functionality mean? Just use as an example
when more than 1 user is working on the same document in Google Documents When a
user is making changes and at the same time another user can see the changes
without reloading the page. So real-time web functionality is the ability to
have server code to push content to connected clients. In the HTTP request
response model we know each time we need to send a new request to communicate
with the server but SignalR provides a persistent connection between the client
and server.
It can be easily scaled out via SQL Server, Redis or a service bus (scale out
means adding more servers to handle the load). There is no need to worry about
this scale out term, in my next article I will explain it in detail because
SignalR provides good scale out features. SignalR uses Web socket technology to
send data. WebSocket is a new HTML5 API that enables bidirectional communication
between the browser and server but if it is not available then SignalR can use
other technologies like long polling.
SignalR transfers data in non-compressed JSON text or plain text so if you want
to send data in compressed JSON then you need to write your own logic on the
server side and the same logic on the client side also. SingnalR makes extensive
use of asynchronous techniques to achieve immediate and maximum performance.
Modes of communication
SignalR provides two models for communicate between clients and severs.
1. Persistent Connections
Persistent Connections provide direct access to a low-level communication
protocol that signalR provides. Each client connection to a server is identified
by a connectionID. So in your application if you need more control over a
connection, in SingnalR you can use this model. This midel can be used where you
want to work with a messaging and dispatching model rather than remote
invocation or in any existing application using a message model and you want to
port to signalR.
2. Hubs
Hubs provide a High level API for the client and server to call each other's
method. It will be very familiar to those developers who have worked on remote
invocation APIs. If you have multiple types of messages that you want to send
between a server and a client then it is recommended to use Hubs so you don't
need to do your own dispatching. You can create an application either using Hubs
or a Persistent connection; the only concern is, with Hubs it will be easy to
implement.

So now we have an idea of what SignalR is so now it's time to proceed to "why".
WHY use SignalR
Using SignalR we can create web applications that require high frequency updates
from the server. For examle, a dashboard, games and chat applications. SignalR
uses Web Sockets and the HTML5 API that helps in bidirectional communication. It
also provides an API for server-to-client Remote Procedure Calls (RPC) call, it
may be something new for you because most of the time we use a request and
response model.
SignalR includes automatic connection management, it provides the facility to
broadcast messages to all connected clients or to a specific client. The
connection between the client and server is persistent while in HTTP it isn't
persistent.
So now where to use SignalR:
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.


zaheen harisPosted Jul 17, 2018, 4:11 AM
Very good article
Avnish KumarPosted Mar 5, 2018, 6:54 AM
Very nice explanation.....................................................
Ganapathi RamanPosted Nov 27, 2017, 1:56 AM
Well explanation about SignalR. Thanks a lot.
manoj sharmaPosted Sep 16, 2017, 1:46 AM
Very nice but I want to see code as well
Former memberPosted Jun 27, 2017, 8:17 AM
What is persistent api and how it is different from hub ?
Rahulprasad YadavPosted Feb 20, 2017, 1:36 AM
How SignalR chat work in Virtual PC?
Rahulprasad YadavPosted Feb 20, 2017, 12:07 AM
Is it possible to use SignalR outside of a Microsoft Environment like critic Environment . when i pushing the content to connected client its broadcasting to everyone so can you explain. How SignalR is working in its taking any physical ip address for establishing connection.
hari prasadPosted Jul 14, 2015, 6:15 AM
article is good but where is the continuation article for this ??
Shihabudheen K. H.Posted Jun 1, 2015, 6:34 AM
very nice
shravan kumarPosted Dec 22, 2014, 9:56 AM
thnq so much... very nice explanation...