// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Diagnostics.Contracts; using Microsoft.AspNet.SignalR; using Microsoft.AspNet.SignalR.Hubs; namespace System.Web.Http { /// /// Defines a base class for that exposes functionality for calling back /// to clients connected to a particular SignalR hub. /// [CLSCompliant(false)] public abstract class HubController : HubControllerBase { private string _hubName; /// /// Initializes a new instance of the class. /// /// Name of the hub as specified by the . protected HubController(string hubName) { if (hubName == null) { throw Error.ArgumentNull("hubName"); } _hubName = hubName; } /// /// Gets the for the associated hub. /// protected override IHubContext HubContext { get { Contract.Assert(ConnectionManager != null); return ConnectionManager.GetHubContext(_hubName); } } } }