What is SignalR ?
ASP.NET SignalR is a new library for ASP.NET developers that makes developing real-time web functionality easy. SignalR allows bi-directional communication between server and client. Servers can now push content to connected clients instantly as it becomes available. SignalR supports Web Sockets, and falls back to other compatible techniques for older browsers. SignalR includes APIs for connection management (for instance, connect and disconnect events), grouping connections, and authorization.
Features of this exercise after you complete:
# Send real time message to client without client refreshing the page
# Receive real time communication or message from client without refreshing the page.
#Send message to all connected clients.
# Send message to specific client.
# Send message to all client except one who sent it…
# This is a proof of concept …. you can extend it to the way you want…
How to Install SignalR to MVC C# ?
Steps :
- Open Visual Studio 2015
- Create New MVC Project
- Install SignalR from Nuget Package – Install-Package Microsoft.AspNet.SignalR -Version 2.2.2
- Create SignalR Hub
- Create Owin Startup File
- Create A view and include SignalR library reference
- Test the Application
- Extend the functionality to the ActionMethod
Testing the SignalR
http://localhost:53588/SignalR/hubs
Now Open the index view and replace the code
Output Sample
Download the complete source code from here.
If you want to extend this to a working application then please proceed to part 2 of this tutorial