遍历signalR集线器类中的组 [英] Iterate through groups in signalR hub class

查看:107
本文介绍了遍历signalR集线器类中的组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何遍历SignalR组(集线器类) Groups.Add(Context.ConnectionId,"foo");

How can I iterate through a SignalR group (hub class) Groups.Add(Context.ConnectionId, "foo");

我将如何遍历该小组以了解谁在其中?然后可能基于其中的connectionId返回用户

How would I iterate through the group to see whose in it? and then possibly based on the connectionId in there return a user

推荐答案

来自 SignalR文档:

组未持久保存在服务器上,因此应用程序负责跟踪哪些组中的连接,以便可以实现组计数之类的事情.

Groups are not persisted on the server so applications are responsible for keeping track of what connections are in what groups so things like group count can be achieved.

因此,不能,您不能遍历组中的用户,您需要自己对其进行跟踪.

So no, you can't iterate over the users in a group, you need to keep track of that yourself.

这篇关于遍历signalR集线器类中的组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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