0

I have client-side code that sends requests to server for some data. Sometime server don't respond and it take too long to establish connection. I want to set some timeout functionality on client-side so after that timeout, client will stop to try connecting server. In simple web request we can use timeout functionality. For example I am using the following code somewhere else and it is working fine for non-signalr request.

But when I send request through signalr, I can not set timeout to end this request and show user a message that data could not be fetched from server. On this site someone suggested "Send a specific string to the client to force the disconnect" but that is not my scenario. I want to handle it on client side.

var refit = RestService.For<SomeApi>(new HttpClient
{
    BaseAddress = new Uri(BASE_URL),
    Timeout = TimeSpan.FromSeconds(30)
});
user6159419
  • 247
  • 2
  • 19

0 Answers0