...

/

HTTP Transport Configuration

HTTP Transport Configuration

Learn about all the HTTP transport configurations.

Background

We'll now locate the line that contains app.MapHub and replace it with the following code:

Press + to interact
app.MapHub<LearningHub>("/learningHub", options =>
{
options.Transports =
HttpTransportType.WebSockets |
HttpTransportType.LongPolling;
options.CloseOnAuthenticationExpiration = true;
options.ApplicationMaxBufferSize = 65_536;
options.TransportMaxBufferSize = 65_536;
options.MinimumProtocolVersion = 0;
options.TransportSendTimeout = TimeSpan.FromSeconds(10);
options.WebSockets.CloseTimeout = TimeSpan.FromSeconds(3);
options.LongPolling.PollTimeout = TimeSpan.FromSeconds(10);
Console
.WriteLine($"Authorization data items: {options.AuthorizationData.Count}");
});

Applying advanced transport configuration

These are the options where you apply transport settings. Let’s now examine these settings one by one.

  • Transports: This setting allows us to set the availability of SignalR transport mechanisms. By default, it supports WebSocket, long polling, and ...