问题标签 [signalr-hub]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
3036 浏览

asp.net-mvc-3 - SignalR .Net 客户端无法连接(更新:如何设置 auth.cookie?)

这件事让我抓狂。

我有一个 .net 4.0 控制台应用程序和一个 MVC Web 应用程序。

javascript 客户端可以连接并与服务器对话 - 这里没有问题...

但我的 .net 客户端抛出 System.AggregateException with InnerException = "解析值时遇到意外字符:<.Path...

所以我创建了一个空的 MVC3 应用程序,添加了 SignalR 库,.net 客户端令人惊讶地连接到它。但由于某种原因,它对另一个没有。我已经检查了所有内容,两个 MVC3 应用程序,都使用相同的 SignalR 库,相同的 NewtonsoftJson ......我认为它一定与路由有关,我猜不是 - js 客户端工作。

会是什么呢?

UPD:我想...这是因为服务器上的 FormsAuthentication。现在有什么方法可以将 .ASPXAUTH cookie 提供给 SignalR,以便它可以连接到服务器?

0 投票
1 回答
1606 浏览

ios - SIGnalR iOS 客户端为 connectionId 和协议版本返回 null

我正在尝试将我的 iOS 应用程序集成到我们在本地网络上的开发服务器上设置的 MVC3(框架 4)SignalR 程序。为此创建的网站在我们的网络中运行良好。

但是,当尝试使用 SignalR iOS 客户端时,会出现以下错误:

在 SRConnection.m 中使用了一些 NSLog() 后,我发现当应用程序协商成功但没有获得 connectionId 或协议版本时,这些返回 null

我正在应用程序中设置连接:didFinishLaunchingWithOptions:appDelegate 的功能。这就是我设置连接的方式:

我还查看了服务器上的连接日志。它正在接收请求并每次返回状态码 200..

我为此使用的连接代码已关闭http://chrisrisner.com/iOS-and-Windows-Azure-Communication-using-SignalR ..

我尝试在示例中使用 url 和 hub 名称,并且可以与 connectionId 和协议版本协商,如下所示:

这也在 iOS sdk6 上的 iPad Simulator 中,部署目标为 iOS 5.1

对此的任何帮助都会很棒

干杯

0 投票
1 回答
594 浏览

asp.net-mvc-3 - 通过浏览器访问 SignalR 集线器

如何通过浏览器访问 Signalr Hub?我在其中创建了名为“testhub”(使用HubName属性)和方法“Hello”的集线器,所以我想像这样访问它:http://serverurl/signalr/testhub/Hello

0 投票
1 回答
143 浏览

signalr - Windows 应用程序中的 SignalR

请,任何人都可以展示一个如何在 Windows 应用程序中实现 signalR 的示例。我需要在服务器端启动时显示一个消息框

0 投票
2 回答
2403 浏览

signalr - IIS 6 / windows server 2003 R2 上的 SignalR 配置

当我访问部署在 IIS 6 / winSrv 2003 r2 上的 Web 应用程序上的信号器/集线器 URL 时,我收到错误 404。

我试过 runAllManagedModulesForAllRequests = true 和 false。但是我在其中一个#issues 中发现了一条评论,说这是针对II7 和> 的。

此外,我将通配符映射设置为 v4.0.30319\aspnet_isapi.dll 并且仍然得到相同的错误 404。

IIS 6 日志错误:

W3SVC1 127.0.0.1 GET /devweb/signalr/hubs - 80 - 127.0.0.1 Mozilla/4.0+(兼容;+MSIE+7.0;+Windows+NT+5.2;+Trident/4.0;+.NET+CLR+1.1.4322 ;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.4506.2152;+.NET+CLR+3.5.30729;+.NET4.0C;+.NET4.0E) 404 0 3

当我在 Win7 上部署到 IIS 7 时工作正常。我还需要让它在 IIS 6 上运行,以便可以将其部署给一些客户。

0 投票
3 回答
8685 浏览

asp.net - 获取 SignalR 集线器内的完整 URL

我正在为 ASP.NET MVC 应用程序开发一个使用 SignalR 的用户跟踪解决方案,作为一个学习 SignalR 的有趣项目。

目前我可以跟踪登录的用户以及他们在特定页面上的停留时间。如果他们移动到另一个页面,我也会跟踪它,并且 SignalR 正在更新的计时器会重置......许多其他功能已实现或部分实现。

我面临的问题是如何在 SignalR 集线器中获取完整的 url Controller/Action/Parameters?

当我使用HttpContext.Current.Request.Urlurl 总是/signalr/connect

笔记:

在 _Layout.cshtml 中。

更新:

我试过用

并且该位置已正确传递,但我稍后需要在 Connect() 任务中使用它。是否有可能做到这一点?

更新 2:

这种方法行不通

正如Connect()之前所说的那样。

在我的集线器中,我有几种方法,但我想将一个值(在我的情况下是一个位置)传递给Connect(),这可能吗?

更新 3

使用 QueryString 在发生之前传递数据Connect()

0 投票
1 回答
353 浏览

signalr - 在 ASP.NET 中托管“n”个 SignalR 集线器(但包含 MEF)

我有一个 ASP.NET Web 项目,我需要在其中托管多个 SignalR 集线器,另一个 MVC3 应用程序将与之通信。

我的主要问题是直到运行时我才知道我将托管哪些集线器,因为它们需要被 MEF 插入。包含导出(IXXXHub 类型)的 DLL 将位于 ASP.NET Web 的 bin 目录中地点。目前有 3 种可导出类型 - AHub、BHub 和 CHub,但可能还有更多,例如 DHub 可能会在以后实施。

我已经浏览了 SignalR 示例,展示了如何在 ASP.NET Web 项目中托管,所以我感到困惑的部分是试图让我的 MEF 进入并托管 AHub/BHub/CHub 中的每一个。我已经查看了使用 Application_Start 的各种方法,但无法弄清楚如何。

有人有想法吗?

0 投票
1 回答
2838 浏览

performance - SignalR performance issues with HubConnection (lots of threads in server, long delays between delivery)

we've written a prototype to test SignalR performance to check whether we can use it for our software. In that prototype we've tested both, forwarding data to clients via PersistentConnection and via HubConnection.

Our stresstest consists of three components:

  • 1 "client" that registers to the hub and subscribes to messages
  • 1 hub that is responsible for receiving and forwarding messages (selfhosted)
  • 1 "driver" that involves 5 threads where each of thread fires 1000 messages through the hub to the clients

The PersistentConnection runs rather stable, but in the HubConnection we noticed lots of threads in the Hub and long delays (varies between 1 and 10 seconds) between every few hundred packets. The delays mainly occur within the Hub (and also between the hub and the client). We also have slight delays within the delivery from the "driver" to the Hub. With delay I mean that the method call to the Hub return delays (in the driver) or that the client receive method call is called much later. From time to time we also have some messages lost (not delivered to the client).

Any idea where that might come from? Is this a known bug? Is there any option that we can tweak? I have a complete solution as working example that I can provide upon request.

Thx alex

0 投票
1 回答
20858 浏览

c# - SignalR 向单个 connectionId 发送消息

我有一个 asp.net 经典网站。我让 SignalR 基本功能正常工作(一个客户端向其余客户端发送消息)。但现在我只想将消息发送到特定的连接 ID。

我的集线器:

ASP代码:

问题是我真的不知道如何使用集线器发送到一个特定的 ConnectionID,因为 Clients.updateMessages(messages); 向他们所有人发送消息。我该如何解决这个问题?

PS:我已经看过:Send server message to connected clients with Signalr/PersistentConnection

http://riba-escapades.blogspot.dk/2012/05/signalr-send-messages-to-single-client.html

那没有用。

0 投票
2 回答
3161 浏览

asp.net - 从页面导航时,当页面加载错误时,signalR 中断

当导航离开具有 signalR 连接/连接集线器的页面时,我收到以下错误消息。

连接到“http://localhost:53604/signalr/signalr/connect?transport=serverSentEvents&connectionId=0b308c0d-2122-4e60-a9fa-f6e3f3eb1f4e&connectionData=%5B%7B%22name%22%3A%22packageactionstatus%20%22%7D %5D&tid=9"在页面加载时被中断

我确实了解由于离开页面而导致连接丢失(这很好),但是在离开当前页面之前是否有安全的方法来停止连接?