SignalR call client methods from outside the Hub class AspNetCore

≯℡__Kan透↙ 提交于 2019-12-18 09:19:09

问题


I'm trying to call client methods outside the hub on SignalR, the link below shows how to do this in the old version, although i'm unsure how to do this in the SignalR ASP.NET Core version. I've found a reference to a old post and using a reference to Microsoft.AspNetCore.SignalR.Infrastructure.IConnectionManager although this namespace doesn't seem to existing anymore. An example would be great?

Old version: How to call client methods and manage groups from outside the Hub class


回答1:


You need to inject IHubContext<THub> and then should be able to invoke methods.



来源:https://stackoverflow.com/questions/46332651/signalr-call-client-methods-from-outside-the-hub-class-aspnetcore

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!