如何发送对组列表的响应并在SignalR Core中排除某些连接ID?

发布于 01-21 16:30 字数 705 浏览 3 评论 0原文

在aspnet.signalr.core中,在ihubConnectionContext中,您可以将响应发送到一个组列表,同时排除某些连接IDS,即:

T Groups(IList<string> groupNames, params string[] excludeConnectionIds);

现在,

Clients.Groups(groupNames, exconnectionIds).ReceiveCollaborationNotification(response);

我已经迁移到<<<代码> aspnetcore.signalr.core ,没有这样的方法同时接受要排除的组名称和连接ID的列表。它确实具有下面提到的方法,但是该方法仅接受一个组名称,而不是列表。

T GroupExcept(string groupName, IReadOnlyList<string> excludedConnectionIds);

我如何实现t组(iList&lt; string&gt; groupNames,params string [] excludeConnectionIdsaspnetcore.signalr.core.core.core中使用

In AspNet.SignalR.Core, there was this method in IHubConnectionContext where you can send a response to a list of groups while excluding some Connection Ids i.e:

T Groups(IList<string> groupNames, params string[] excludeConnectionIds);

This would be called as:

Clients.Groups(groupNames, exconnectionIds).ReceiveCollaborationNotification(response);

Now I have migrated to AspNetCore.SignalR.Core and there is no such method that accepts both a list of group names and Connection Ids to be excluded. It does have the method mentioned below but this one only accepts one group name, not a list.

T GroupExcept(string groupName, IReadOnlyList<string> excludedConnectionIds);

How can I achieve what T Groups(IList<string> groupNames, params string[] excludeConnectionIds does in AspNetCore.SignalR.Core

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

嘴硬脾气大 2025-01-28 16:30:53

在Signalr Core中,您具有此扩展方法:

public static T GroupExcept<T> (this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string groupName, string excludedConnectionId1, string excludedConnectionId2, string excludedConnectionId3, string excludedConnectionId4, string excludedConnectionId5, string excludedConnectionId6, string excludedConnectionId7, string excludedConnectionId8);

您可以阅读有关它的更多信息在这里

因此,为了实现自己想要的东西,您需要使用这些扩展方法

In SignalR Core, you have this extension method:

public static T GroupExcept<T> (this Microsoft.AspNetCore.SignalR.IHubClients<T> hubClients, string groupName, string excludedConnectionId1, string excludedConnectionId2, string excludedConnectionId3, string excludedConnectionId4, string excludedConnectionId5, string excludedConnectionId6, string excludedConnectionId7, string excludedConnectionId8);

You can read more about it here.

So to achieve what you want, you will need to use these extension methods.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文