Configuring SignalR Server
Learn to configure the SignalR server.
Overview
We will begin by applying some advanced configurations to the SignalR server. Before we start, we need to make sure that the Program.cs
file is in the SignalRServer
project.
-SignalRServer-Program.cs
We can locate this file by writing the following path in the terminal below:
cd SignalR-on-.NET-6---the-complete-guide/Chapter-06/Part-03/LearningSignalR/SignalRServer
It has the following namespace references:
using Microsoft.AspNetCore.Http.Connections;using System.Text.Json.Serialization;
On the server side, there are three levels of configuration:
Top-level SignalR configuration.
Message protocol configuration.
HTTP transport configuration.
Let’s cover all these categories one by one.
Top-level SignalR configuration
We will begin by locating the following line in the Program.cs
file. We can locate this file by writing the following path in the terminal given below:
cd SignalR-on-.NET-6---the-complete-guide/Chapter-06/Part-03/LearningSignalR/SignalRServer/
We will then insert the following block into the brackets at the end of the AddSignalR
method call:
builder.Services.AddSignalR();