Introduction To SignalR With .NET Core - Part One

Introduction

SignalR is an open source library which helps to add real-time web functionality to your application. It also enables the server side to push the content to the client instantly rather than the server waiting for the client request from a user for new data.

SignalR can be used for that kind of application where there is a high frequency of updates from the server, such as social networking etc. Also, it is very helpful where the application requires notifications, such as email, games, etc. It has been used in dashboards and monitoring applications.

SignalR has been rewritten for ASP.NET Core 2.1 which helps with improvements in several areas like,

  • No jQuery dependency.
  • Supports custom protocols.
  • Streaming response model.
  • Simplified scale-out model.
  • WebSockets support.

Some of the popular features of SignalR are -

  • It handles connection management automatically.
  • It can send the message to all the connected client simultaneously.
  • It is also very useful to send the message to a specific client or group of clients.
  • Scales in / out automatically to handle traffic.

Signal R is very popular in handling multiple real-time communications, such as Web Sockets, Server-Sent Events, Long Polling. Also, it automatically selects the best transport method which is suitable for the server and client which is called HUBS.

SignalR With .NET Core 

A hub is used to communicate between a server and a client in SignalR. It is basically a high-level pipeline which allows the client and the server to call methods on each other.

It has basically two built-in hub protocols -

  • Text Protocol (based on JSON)
  • Binary Protocol (based on Message Pack)

In this mechanism, hubs call a client-side method by sending the messages which contain the name of the method and its parameter. The method parameters are de-serialized using the configured protocol and if the client matches the name of the method and if it is found, it calls that method and de-serializes the parameter data.


Similar Articles