SignalR 从 Hub 外部调用客户端方法 class AspNetCore

SignalR call client methods from outside the Hub class AspNetCore

我正在尝试在 SignalR 的集线器外调用客户端方法,下面的 link 显示了如何在旧版本中执行此操作,尽管我不确定如何在 [=11] 中执行此操作=] 并使用对 Microsoft.AspNetCore.SignalR.Infrastructure.IConnectionManager 的引用,尽管此名称空间似乎不再存在。举个例子就好了?

旧版本:How to call client methods and manage groups from outside the Hub class

您需要注入 IHubContext<THub> 然后才能调用方法。