SignalR和大量群组 [英] SignalR and large number of groups

查看:346
本文介绍了SignalR和大量群组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SignalR的最新版本,这很棒.但是,我最近遇到了一个有趣的扩展问题:似乎SignalR在查询字符串中发送了来自客户端的所有客户端组.我的系统要求一个人加入多个组,这些组代表用户订阅的所有项目,并接收有关任何项目的通知.

I'm using SignalR's latest version and it's great. However, I've recently hit an interesting scaling issue: it seems that SignalR sends all the client's groups from the client in the query string. My system requires that a person join numerous groups, which represent all the projects that the user is subscribed to, and receive notifications on any of them.

大量的组(我使用的是GUID作为ID)导致查询字符串达到其最大大小,并且SignalR停止工作.

this large number of groups (and me using GUIDs for ids) has caused the querystring to reach its maximum size, and SignalR to stop working.

这是Fiddler在请求Web表单中显示的内容(对Azure bug使用长时间轮询):

This is what Fiddler shows in the request webform (using long polling for the Azure bug):

transport   longPolling
connectionId    bbed6f35-8379-4be3-ac28-ef3e618382ae
connectionData  [{"name":"jethub"}]
messageId   85
groups  ["JetHub.f9f81bcc-8417-46bd-bae5-c4134972601d","JetHub.5139a8de-04c2-48da-9427-39666e52fabd","JetHub.6b12e333-4d22-47c3-8587-7a9ad5026184","JetHub.252ea279-7a71-40e7-b03c-7d63e69f07ab","JetHub.a4843a77-1e6d-4693-b3de-b392ef465410","JetHub.27feb53a-3c2d-4b11-92f7-dbdffb874b25","JetHub.8840dfcf-e6be-4b72-965b-b282a60446e8","JetHub.bf7d3301-6fc0-4499-bee8-fe22f1bc2281","JetHub.655cba0e-7f72-402c-b80b-dcb740546163","JetHub.85d817e2-67a3-4291-b564-5320598339f6","JetHub.e3079263-3f6e-4a54-ad88-0dfc5dd2ce18","JetHub.33f00a67-9b05-4293-8119-4617e2fed9b0","JetHub.6323cfe8-fb81-4716-b553-79b9d72641a5","JetHub.b4359f8a-030a-4ac9-aacd-c05b42163bcc", ... many more]

我知道我可以在IIS中增加查询字符串的大小,但是是否有更好的方法来管理组,还是应该尝试创建服务器端分组方案并分别广播到每个客户端? PersistenConnections可以在这方面提供帮助吗?

I know I can increase the querystring size in IIS, but is there a better way to manage groups, or should I try to create my server-side grouping scheme and broadcast to each client separately? can PersistenConnections help in that regard?

谢谢.

推荐答案

当通过SignalR 0.5.3中的查询字符串来对组进行往返时,您可以使用以下选项: a)增加最大查询字符串大小 b)使用较短的组名 c)在服务器上处理自己的分组并分别广播给每个用户

As groups are roundtripped via the query string in SignalR 0.5.3, you have the following options: a) increase the maximum query string size b) use shorter group names c) handle grouping yourself on the server and broadcast seperately to each user

PersistentConnections在这里无济于事,因为Hub API是建立在它们之上的,因此您将遇到相同的问题.

PersistentConnections won't help here as the Hub API is built on top of them, so you'll run into the same problem.

这篇关于SignalR和大量群组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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