Skip to content

Customizable serverTimeoutInMilliseconds in Server-Side Blazor #18840

@mvarblow

Description

@mvarblow

When debugging a server-side blazor app we often see this error pop up in the client (browser) while stepping through code:

Error: Connection disconnected with error 'Error: Server timeout elapsed without receiving a message from the server.'.

This can be pretty disruptive, requiring a refresh of the browser to recover after continuing the debug session.

Presumably, this happens because the server isn't sending keepalives on the SignalR connection while I'm stepping through code in the debugger. When running in a 'development' environment, I'd like to be able to customize the serverTimeoutInMilliseconds on the HubConnection to prevent this. I see examples of how to customize the SignalR settings for a server-side Blazor app using code like this:

<environment exclude="Development">
    <script src="_framework/blazor.server.js"></script>
</environment>
<environment include="Development">
    <script src="_framework/blazor.server.js" autostart="false"></script>
    <script>
        (function start() {
            Blazor.start({
                logLevel: 1, // LogLevel.Debug
                configureSignalR: builder => builder.configureLogging("debug") // LogLevel.Debug
            });
        })();
    </script>
</environment>

However, I'm unable to change the serverTimeoutInMilliseconds setting. This setting is available on the HubConnection object, but I don't have access to that object. I only have access to HubConnectionBuilder. And HubConnectionBuilder doesn't have a serverTimeoutInMilliseconds property.

It seems like adding support for configuring the serverTimeoutInMilliseconds via HubConnectionBuilder would be the simplest solution.

Even nicer would be some way to configure this setting in my Startup.cs, probably with a new property available somewhere under the AddServerSideBlazor call, similar to how I can customize the server-side hub settings via AddServerSideBlazor().AddHubOptions(options => ... ).

Metadata

Metadata

Assignees

Labels

Blazor ♥ SignalRThis issue is related to the experience of Signal R and Blazor working togetheraffected-mostThis issue impacts most of the customersarea-blazorIncludes: Blazor, Razor Componentsarea-signalrIncludes: SignalR clients and serversenhancementThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-serverseverity-blockingThis label is used by an internal tool

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions