how to set "HubConnection.ServerTimeout" in javascript client , like .net client
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
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.
Most helpful comment
For the javascript client you can set the timeout after the connection has been created.