Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the timeout for SignalR persistence connection?

I created Chat application using SignalR and Asp.net MVC. if user is idle for sometime, he didn't receive any messages from the server.

Is there any timeout for SignalR persistence connection ?

If yes, how do I modify or reactivate my connection ?

like image 849
Durga Prasad Avatar asked Dec 06 '22 15:12

Durga Prasad


2 Answers

This has now been upated on the Wiki https://github.com/SignalR/SignalR/wiki/Configuring-SignalR

Code

using System;
using SignalR;

namespace WebApplication1
{
    public class Global : System.Web.HttpApplication
    {
        void Application_Start(object sender, EventArgs e)
        {
            // Make connections wait 50s maximum for any response. After
            // 50s are up, trigger a timeout command and make the client reconnect.
            GlobalHost.Configuration.ConnectionTimeout = TimeSpan.FromSeconds(50);
        }
    }
}
like image 90
Tim B James Avatar answered Jan 08 '23 20:01

Tim B James


SignalR's default timeout is 110 seconds for any connection. It will reconnected automatically and you shouldn't miss any messages. That sounds like you have some other problem. If you want to tweak the timeout in 0.4 like this (assuming asp.net):

// Make idle connections reconnect every 60 seconds
AspNetHost.DependencyResolver.Resolve<IConfigurtionManager>().ReconnectTimeout = TimeSpan.FromSeconds(60);

Make sure You add using SignalR.Infrastructure to get the Resolve extension method (we're fixing this in the next version).

like image 23
davidfowl Avatar answered Jan 08 '23 18:01

davidfowl