Search code examples
c#signalrsignalr-hubsignalr.client

Calling SignalR hub methods from a different project


In the solution I have a SignalR Server hub that users connect to. In the other project of the Server I want to call the Client methods. However SignalR Hub is not static, and if I declare a new SignalR hub class then it will have different connections then the original hub.

How can I reference the original SignalR hub in a different project?


Solution

  • Use GlobalHost.ConnectionManager.GetHubContext<YourHubClass>() on which you can call Clients.