Skip to content

Configuring SignalR

davidfowl edited this page May 10, 2012 · 15 revisions

Configuring SignalR

Each host has access to an IConfigurationManager which allows you to tweak some default SignalR settings. Some things that can be tweaked are:

  1. ConnectionTimeout - Represents the amount of time to leave a connection open before timing out. Default is 110 seconds.
  2. DisconnectTimeout - Represents the amount of time to wait after a connection goes away before raising the disconnect event. Default is 20 seconds.
  3. HeartBeatInterval - Represents the interval for checking the state of a connection. Default is 10 seconds.
  4. KeepAlive - Representing the amount of time to wait before sending a keep alive packet over an idle connection. Set to null to disable keep alive. This is null by default.

ASP.NET Example (Global.asax)

using System;
using SignalR;

namespace WebApplication1
{
    public class Global : System.Web.HttpApplication
    {
        void Application_Start(object sender, EventArgs e)
        {
            GlobalHost.Configuration.ConnectionTimeout = TimeSpan.FromSeconds(50);
        }
    }
}

Clone this wiki locally