I have just started using SignalR for ASP.NET Core. I have used SignalR for ASP.NET for a couple of years.
I am using:
Microsoft.AspNetCore.All 2.0.7
Microsoft.AspNetCore.SignalR 1.0.0-preview2-final
Microsoft.AspNetCore.SignalR.Client 1.0.0-preview2-final
It appears that in the ASP.NET Core version of SignalR I can no longer use GlobalHost or IConnectionManager to get a reference to a hub context. I can use DI to get a reference to the hub context in a controller without any problems.
public BroadcastController(IHubContext<NotificationHub> hubContext)
{
_hubContext = hubContext;
}
But I need to know how to do it outside of a controller.