private static void OnConnectionOpened(object sender, ConnectionEventArgs e) {
     // Register all open connections for disposing at the end of the request
     HttpContext httpContext = HttpContext.Current;
     if (httpContext != null) {
         HttpContextWrapper httpContextWrapper = new HttpContextWrapper(httpContext);
         httpContextWrapper.RegisterForDispose(e.Connection);
     }
 }