Before start considering SingalR to solve your business problem, you need to make sure that you have the right environment. Signal R can’t be installed in all .net environment as it has minimum requirements… below is the constraints that you have when developing SingalR applicaiotns:
1. Operating System Constraints:
SingalR applications can be installed on the followings operating systems:
- Windows Server 2012
- Windows Server 2008 R2
- Windows 8 and Windows 8.1
- Windows 7
- Windows 10
- Windows Azure.
2. .Net Framework Constraints:
You need to develop your SingalR application using .net 4.5+
3. IIS Constraints:
SingalR app needs to be hosted on the followings IIS versions
- IIS 8
- IIS 8 Express
- IIS7 Support for extensionless URLsis required
- IIS 7.5 Support for extensionless URLsis required
- IIS application pool needs to be running in the integrated mode. Classic mode is not supported.
4. Client Side Scripting Constraints:
Web applications that SignalR communicating with needs to have JQuery version 1.6.4 or greater.
5. Web Browsers Constraints:
SignalR can be used with variety of web browsers, but typically only the latest 2 versions are supported.
The following is the list of web browsers that supported by SignalR at the time of writing this post:
- Microsoft Internet Explorer versions 8, 9, 10, and 11. Modern, Desktop, and Mobile versions are supported.
- Mozilla Firefox: for both Windows and Mac versions.
- Google Chrome: for both Windows and Mac versions.
- Safari: for both Mac and iOS versions.
- Opera: for Windows only.
- Android browser
What is ASP.Net SignalR
SignalR is a Technology that enable Real-Time messages/contents to be pushed from server to connected web clients without the need to refresh the web pages every specific period of time. In the old days, we used to have schedule timer on client side to request new data from server every specific period of time to update client UI with the new data. with SignalR this is no more the case.
Microsoft published a specific library for developers to enable them to add real-time functionlaities to asp.net web application . It is worth to mention here that SignalR is an open source project an you can check the source code on GitHub.
Also SignalR supporting Scale out to thousands of clients using Service Bus, SQL Server or Redis. This enable SignalR to work seamlessly in Web Farm or Web Garden environments with no issues to mention.
SignalR Usage Examples:
Chat applications over web is a great example of the usage of SignalR, Auto update client screens with currency exchange rates where user will get live updates with currency exchange rates as it is got changed
SignalR Communication Models:
There is 2 ways of communication models between Server and Clients using SignalR; Persistent Connections and Hubs
1. Persistent Connections: A Connection represents a simple endpoint for sending single-recipient, or broadcast messages. The Persistent Connection enables the developer to have a direct access to the low-level communication protocol that SignalR exposes.
for those who worked with connection-based APIs in Windows Communication Foundation WCF, will be easily getting familiar with this model.
2. Hubs: is a more high-level that is built on top of connection API and allow server and clients to be able to call methods on each other directly and seamlessly. It is SignalR responsibility to handles the dispatching messages over the internet; SignalR MAGIC!
For those who use Remote Invocation APIs such as .NET Remoting will be getting familair with this model easily.
The Hub Communication model is suitable for most of the applications needs. For me I never get into a case where I have to use Persistent connection model, and I always go to Hubs model.
One of the Diagram that make it easy to understand the SignalR magic that I copied from www.asp.net site is the below one.. where it is showing that client can call server method easily and server can call a method on web client with no issues. This wasn’t possible without SignalR