-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API proposal: enable configuring connection timeouts in HubConnectionBuilder #44742
Comments
@BrennanConroy , any updates on this API proposal? Do you think this is worth implementing or should we implement the alternative design (#44623)? |
We need to put what the API will look like in the issue. Example: #43355 (comment) Also, we probably want to do this across all the clients, not just the Typescript one. |
Included what API will look like for TypeScript and C# clients. Also opened a PR for it. If the proposed design looks good I will proceed with Java client. |
Thanks, simplified it because we don't need to see the implementation (and all the doc comments etc.) during API review. |
Thank you for submitting this for API review. This will be reviewed by @dotnet/aspnet-api-review at the next meeting of the ASP.NET Core API Review group. Please ensure you take a look at the API review process documentation and ensure that:
|
API Review Notes:
TSexport class HubConnectionBuilder
{
+ public withServerTimeout(milliseconds: number): HubConnectionBuilder;
+ public withKeepAliveInterval(milliseconds: number): HubConnectionBuilder;
} Example Usage: Blazor.start({
configureSignalR: function (builder) {
builder.withServerTimeout(60000).withKeepAliveInterval(3000);
};
}); C#namespace Microsoft.AspNetCore.SignalR.Client;
public static class HubConnectionBuilderExtensions
{
+ public static IHubConnectionBuilder WithServerTimeout(this IHubConnectionBuilder hubConnectionBuilder, TimeSpan timeout);
+ public static IHubConnectionBuilder WithKeepAliveInterval(this IHubConnectionBuilder hubConnectionBuilder, TimeSpan interval); JavaWe also approve the equivalent change to Java's HttpHubConnectionBuilder. API Approved! |
We had an internal conversation about moving the C# client's
The API reviewers agreed that it makes sense to move the methods. The updated approved API for the C# client is now: C#namespace Microsoft.AspNetCore.SignalR.Client;
public static class HubConnectionBuilderExtensions
{
+ public static IHubConnectionBuilder WithServerTimeout(this IHubConnectionBuilder hubConnectionBuilder, TimeSpan timeout);
+ public static IHubConnectionBuilder WithKeepAliveInterval(this IHubConnectionBuilder hubConnectionBuilder, TimeSpan interval); I've updated the original API approval comment to reflect this. |
Background and Motivation
Related to #18840
When debugging a server-side blazor app customers 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 disruptive, requiring a refresh of the browser to recover after continuing the debug session.
The workaround for this is to set
serverTimeoutInMilliseconds
forHubConnection
inBlazor.start
.Instead of overriding build method of
HubConnectionBuilder
with setserverTimeoutInMilliseconds
it would be nice to set this things directly in the builder:Proposed API
TypeScript Client
Enable configuring the connection timeouts in
HubConnectionBuilder
likeserverTimeoutInMilliseconds
andkeepAliveIntervalInMilliseconds
.C# Client
Usage Examples
Customers will use it to configure the connection timeout in server-side blazor app like so:
Alternative Designs
As an alternative we can add a delegate to
Blazor.start
to configureHubConnection
Risks
I'm don't think there are any
The text was updated successfully, but these errors were encountered: