如果我有多个可以使用多个中心类的页面,管理它的最佳方法是什么?
例如:
导航到网站中的另一个页面并实质上“重新打开”与上一页上打开的同一中心类的连接是否不好?
我是否认为在一个页面上打开多个集线器连接是正确的,因为它们都统一在一个连接中,即使它们是不同的集线器类也是如此?
最佳答案
您可以让多个集线器在您的站点上共享一个连接。 SignalR 2.0 已更新,可以通过一个信号连接处理多个集线器,而不会降低性能。
官方文档:http://www.asp.net/signalr/overview/signalr-20/hubs-api/hubs-api-guide-server#multiplehubs
All clients will use the same URL to establish a SignalR connection with your service ("/signalr" or your custom URL if you specified one), and that connection is used for all Hubs defined by the service.
There is no performance difference for multiple Hubs compared to defining all Hub functionality in a single class.
关于c# - 您网站上的多个 signalR 连接/集线器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11764360/