Aspnetcore.docs: ServerTimeout

Created on 5 Jun 2018  Â·  5Comments  Â·  Source: dotnet/AspNetCore.Docs

how to set "HubConnection.ServerTimeout" in javascript client , like .net client


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Source - Docs.ms

Most helpful comment

For the javascript client you can set the timeout after the connection has been created.

const connection = new signalR.HubConnectionBuilder()
    .withUrl("/chatHub")
    .build();

connection.serverTimeoutInMilliseconds = 1000; // 1 second

All 5 comments

Hello @mmfarahat, Great question! Here's a sample you should be able to use now. We will be publishing a document on Configuration soon that will have this in it.

const connection = new signalR.HubConnection(
"/chathub",
{ serverTimeout: 100 });

For the javascript client you can set the timeout after the connection has been created.

const connection = new signalR.HubConnectionBuilder()
    .withUrl("/chatHub")
    .build();

connection.serverTimeoutInMilliseconds = 1000; // 1 second

@rachelappel , @BrennanConroy Thanks

I believe the serverTimeoutInMilliseconds should have a larger value than the KeepAlive which is set on the server side. Or is it the other way around?

That's correct, if serverTimeoutInMilliseconds is smaller than the keep alive on the server then it's very likely your client will think the server is gone and close.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

danroth27 picture danroth27  Â·  3Comments

sonichanxiao picture sonichanxiao  Â·  3Comments

nenmyx picture nenmyx  Â·  3Comments

Rick-Anderson picture Rick-Anderson  Â·  3Comments

YeyoCoder picture YeyoCoder  Â·  3Comments