从Hub类AspNetCore外部调用SignalR的客户端方法 [英] SignalR call client methods from outside the Hub class AspNetCore

查看:418
本文介绍了从Hub类AspNetCore外部调用SignalR的客户端方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在SignalR上的集线器之外调用客户端方法,下面的链接显示了如何在旧版本中执行此操作,尽管我不确定如何在旧帖子的引用并使用对Microsoft.AspNetCore.SignalR.Infrastructure.IConnectionManager的引用,尽管此命名空间似乎不再存在.一个例子会很棒吗?

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?

旧版本:推荐答案

您需要注入IHubContext<THub>,然后应该能够调用方法.

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

这篇关于从Hub类AspNetCore外部调用SignalR的客户端方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆