Chapter 1: Introduction

Chapter 1: Introduction

SignalR is an amazing framework that delivers a real-time and bidirectional messaging platform. SignalR provides several options to reach its goal.  A Hub is a special class that SignalR will expose to all the connected clients, allowing them to make Remote Procedure Calls (RPC) to it. Inside the Hub, the developer will also have a set of special objects to use in order to perform calls back onto the connected clients. There is a very important detail to highlight: SignalR is composed of a server-side library and a set of client-side libraries. In every working solution, you will always need to use both; you will need to expose the server-side endpoints and connect to them using the most appropriate client library. SignalR will do the rest, and you will experience a very natural, simple, and bidirectional programming model.

Good candidates for SignalR: 

  •  Apps that require high frequency updates from the server. Examples are gaming, social networks, voting, auction, maps, and GPS apps.
  •  Dashboards and monitoring apps. Examples include company dashboards, instant sales updates, or travel alerts. 
  • Collaborative apps. Whiteboard apps and team meeting software are examples of collaborative apps. 
  • Apps that require notifications. Social networks, email, chat, games, travel alerts, and many other apps use notifications.

 SignalR provides an API for creating server-to-client remote procedure calls (RPC). The RPCs invoke functions on clients from server-side .NET Core code. There are several supported platforms, each with their respective client SDK. Because of this, the programming language being invoked by the RPC call varies. 

 Here are some features of SignalR for ASP.NET Core: 

  •  Handles connection management automatically.
  •  Sends messages to all connected clients simultaneously. For example, a chat room. 
  • Sends messages to specific clients or groups of clients.
  •  Scales to handle increasing traffic.

Transports

SignalR supports the following techniques for handling real-time communication (in order of graceful fallback):

  •  WebSockets
  •  Server-Sent Events 
  • Long Polling 

SignalR automatically chooses the best transport method that is within the capabilities of the server and client.

Comments