Introduction

Learn to set up Azure SignalR service.

We'll cover the following

Background

In the previous chapter, we looked at how to scale a SignalR Hub by using the Redis backplane. However, we can also scale our hubs by using Azure SignalR Service. This is what we will have a look at in this chapter.

Using Azure SignalR Service has some advantages over using Redis backplane. One of its core advantages is that we will no longer have to host and scale the SignalR Hub ourselves. All we have to do is set up the service on Azure by completing a relatively simple form. Then, we can connect our existing application to this service by making very few code changes.

Perhaps the only disadvantage of using Azure SignalR Service is that we will be limited to using Azure as our hosting provider. It may be an issue if the rest of our assets are hosted on AWS or Google Cloud. Like any cloud-hosted service, we will also be charged for the usage. However, if our application is in the need of being scaled out, then chances are that we will have little choice other than hosting it in the cloud anyway.

Perhaps one notable difference between Azure SignalR Service and Redis backplane is that the former is a complete method of scaling SignalR Hub, while the latter is the way of making multiple hub instances communicate with each other while our application has already been scaled out by replication. When we use Azure SignalR Service, hub connection from a client will be rerouted directly to it, while with Redis backplane, we still need to connect to one of our own application instances directly. So, if SignalR Hub is the only bottleneck in our application that needs to be scaled out, we don’t even have to scale out our main application if we use Azure SignalR Service. On the other hand, Redis backplane still has to replicate the main ASP.NET Core application.

Topics covered

The chapter consists of the following topics:

  • Steps to set up Azure SignalR service.

  • Adding Azure SignalR Service dependencies to your application.

  • Introduction to Azure SignalR Service REST API.

By the end of this chapter, we'll have learned how to set up Azure SignalR Service and how to connect our ASP.NET Core application to it.

Get hands-on with 1200+ tech skills courses.