简体   繁体   English

Signalr-连接已启动,但未使用WebSocket调用客户端事件

[英]Signalr - Connection started but client events not called with websockets

I'm consuming a service using signalr 2.2. 我正在使用Signalr 2.2使用服务。 All was working well using long polling. 使用长时间轮询,一切运行良好。 However since my service started to use websockets the hub events are inconsistent triggered. 但是,由于我的服务开始使用websocket,因此会触发不一致的中心事件。 The connection is stablished but sometimes the clients events works, sometimes aren't triggered. 建立了连接,但有时客户端事件有效,有时不会触发。 I tried several approaches in order to get the code working as was using long polling but without success. 我尝试了几种方法来使代码像使用长时间轮询一样正常工作,但没有成功。

Ps1. PS1。 I'm setup the client events before $.connection.hub.start 我在$ .connection.hub.start之前设置客户端事件
Ps2. PS2。 Sorry, english is not my first language 抱歉,英语不是我的母语
PS3. PS3。 I saw some questions here, but I can't find any solution... 我在这里看到了一些问题,但找不到任何解决方案...

PS4. PS4。 I asked a ticket at github, so I'd glad if you can take a look https://github.com/SignalR/SignalR/issues/3502 我在github上问了票,所以很高兴您能看看https://github.com/SignalR/SignalR/issues/3502

I found out that using eg jQuery SignalR 1.1.3 works fine and events from the hubs are pushed to the clients. 我发现使用jQuery SignalR 1.1.3可以正常工作,并且来自中心的事件被推送到客户端。 For this I use a jQuery component called Kendo Grid from Telerik. 为此,我使用了来自Telerik的名为Kendo Grid的jQuery组件。 To implement this all I use an Angular front end for handling all actions to the hub (which is hosted in an ASP.NET WebAPI) 为此,我使用Angular前端来处理对集线器的所有操作(该集线器托管在ASP.NET WebAPI中)

Only issue I am getting is that when changing it to //ajax.aspnetcdn.com/ajax/signalr/jquery.signalr-2.2.0.min.js that data still is returned by the methods but client events aren't processed anymore by the clients. 我得到的唯一问题是,将其更改为//ajax.aspnetcdn.com/ajax/signalr/jquery.signalr-2.2.0.min.js时,方法仍然返回数据,但不再处理客户端事件由客户。

Thus, my advise for you would be to temporarily downgrade to 1.1.3 to test if it then works. 因此,我建议您暂时降级至1.1.3,以测试其是否有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM