0

I am new to .NET SignalR. I see most of online SignlaR examples for beginners, in a custom Hub class, there is a straight forward way to create custom Hub methods in a derived Hub class without using IHubContext object in those Hub methods. Under which circumstance should I use IHubContext object? Thank you for your help.

Thomas.Benz
  • 8,381
  • 9
  • 38
  • 65

1 Answers1

0

There is a newer way to get the hub

DefaultHubManager hd = new DefaultHubManager(GlobalHost.DependencyResolver);
var hub = hd.ResolveHub("AdminHub") as AdminHub;
hub.SendMessage("woohoo");

This will resolve your to your concrete hub object.

Kelso Sharp
  • 972
  • 8
  • 12