Azure SignalR Service is a fully managed Azure service for web developers to build real-time web application. It uses Server Push method to talk to online clients. This article helps you to know about SignalR and integration with Azure SignalR Service with ASP.NET Core SignalR. Here are the points I will cover in this guide to know about SignalR Service:
- Communication Methods
- Real Time Communication Transports
- What is SignalR
- Supported SignalR Library
- Why SignalR Service
- Sample application using SignalR Service
There are two methods to communicate between server and client such as
- Request-Response: The client sends the request to server to serve the request. Once the request is processed at the server, it sends the response back to client.
- Server Push: It pushes a resource directly to the client without the client asking for the resource. SignalR uses this method to talk to the clients.
Request-response uses hypertext transfer protocol (HTTP). It pulls data from the server (instead of server pushes data down to the client). Unlike request-response, server push uses following transport protocols such as
- Web Sockets: It supports duplex communication. It opens a channel and allows the messages to flow between server and client.
- Server-Side Events: It uses event stream and event source method to receive the update from server to client.
- Forever Frame: It uses a hidden frame to set up the channel to communicate from server to client.
- Ajax Long Polling: It uses long help HTTP polling method to receive messages from server to client.
SignalR uses these four transport protocols. Furthermore, SignalR follows a fallback mechanism to use a specific transport mechanism in case the transport is not supported. The fallback order can also be specified explicitly.
Azure SignalR Service will manage the underlying infrastructure for new and existing ASP.NET Core SignalR workloads. It supports SignalR server applications developed in ASP.NET Core and not ASP.NET Framework. This article will help you to choose SignalR Service. The sample application showcases the infrastructure benefits of Azure SignalR Service.
Azure SignalR Service also provides a REST based API. This can be further used for the use cases like
- Registering a client to Hub
- Sending message to a client
- Broadcast message to a group or all connected clients etc.
The REST based API doesn’t require any ASP.NET Core Signal web application to develop. It supports most of the features out of the box.
A sample application is created in GitHub. The application requires an Azure SignalR Service to create. You can follow a step-by step article here to create the service. The GitHub link to the sample application is mugh-signalrsvc-demo