I have a WebAPI project where the API, Service and Data layers are all in separate projects of the same solution. As part of a method in my Service project, I want to send a message to the connected clients of a hub in the API project. So far all of the examples I have found have everything in a single project and use a controller as the example sending a message via a hub.
I've tried dependency injection (Autofac) however I am unable to get a reference to the MessageHub.
[HubName("messages")]
public class MessageHub : Hub
{
public void ShowNewMessage(string message)
{
Clients.All.showMessageOnPage(message);
}
}
My attempt at Injecting can be seen here: Inject SignalR IHubContext into service layer with Autofac
