Skip to content

Instantly share code, notes, and snippets.

@lkaczanowski
Last active August 29, 2015 13:57
Show Gist options
  • Save lkaczanowski/9629111 to your computer and use it in GitHub Desktop.
Save lkaczanowski/9629111 to your computer and use it in GitHub Desktop.
ApiController with SignalR
// taken from: https://github.com/bradwilson/ndc2012/tree/master/NdcDemo
public abstract class ApiControllerWithHub<THub> : ApiController
where THub : IHub
{
private readonly Lazy<IHubContext> _hub = new Lazy<IHubContext>(
() => GlobalHost.ConnectionManager.GetHubContext<THub>()
);
protected IHubContext Hub
{
get { return _hub.Value; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment