static void UnregisterEventSourceClient(MovieMessageController movieMessageController) { lock (_clients) { _clients.Remove(movieMessageController); } movieMessageController.AsyncManager.OutstandingOperations.Decrement(); }
static void RegisterEventSourceClient(MovieMessageController controller) { controller.AsyncManager.OutstandingOperations.Increment(); controller.HttpContext.Server.ScriptTimeout = (int)TimeSpan.FromHours(1).TotalSeconds; controller.Response.ContentType = "text/event-stream"; controller.Response.BufferOutput = false; controller.Response.Output.WriteLine(); controller.Response.Output.WriteLine(); lock (_clients) { _clients.Add(controller); } }