1

I have a SignalR application (some Chat) hosted with ASP.NET MVC (or even with OWIN, no matter). However, my Hub lives with "its own life", there are no any connections to it from the host available directly.

So, How should that connection/communication with the hosted Hub be organized?

I.e., for instance, if I want to initialize that Hub in certain way (dependently on how the host decides), how can I change some live settings of the Hub from the host?

There are GlobalHost.ConnectionManager.GetHubContext and GlobalHost.ConnectionManager.GetConnectionContext available, which I can use for direct access to Clients and sending something to javascript directly (which direct access actually looks weird for me). But, is there any way to get my Hub instance like:

MyHub hub = GlobalHost...GiveMeTheHubInstance();
hub.CallMyOwnMethod();

Or the only way for that is defining GlobalHost.DependencyResolver and creating some kind of Provider, which will be accessible via DependencyInjection in my Hub?

Community
  • 1
  • 1
Agat
  • 4,577
  • 2
  • 34
  • 62

0 Answers0