SignalR & IE Issue - poll is pending

2019-08-21 15:34发布

I have a Problem With IE and SignalR, I'm using the it to perform a Syncing action between two databases, the Actions Completed successfully on Google Chrome / Firefox / Safari in all scenarios.

Using IE for the First time the sync performed successfully but only for one time, in the second time a pending request stack and the page stay freeze for ever. I found a solution online which is changing the transport mode. But page still freezing.

if (isIE()) {
   $.connection.hub.start({ transport: ['serverSentEvents','foreverFrame']}).done(function () {
       progressNotifier.server.DoMyLongAction();
   });
}else{
   $.connection.hub.start({ transport: ['serverSentEvents','longPolling'] }).done(function () {
       progressNotifier.server.DoMyLongAction();
   });
}

I'm Using: SgnalR v2.1.0.0 .Net framework v4.5 jquery v1.8

is it an Issue or I'm Doing something wrong ?

Edit

my application use Jquery progress bar and i Update this progress bar using this Code: server side:

Clients.Caller.sendMessage(msg, 5, "Accounts");

client side:

progressNotifier.client.sendMessage = function (message, value, Entity) {
      pbar1.progressbar("value", nvalue);
};

it's working on Firefox so I thought it's a signalR Issue !! Now i became confused if it's working as expected then what causes this problem ?

2条回答
一纸荒年 Trace。
2楼-- · 2019-08-21 16:13

The solution you found online is not likely to help your issue.

I doubt your IsIE() function is correctly identifying IE. If it was, SignalR should only be attempting to establish a "foreverFrame" connection, since IE does not even support "serverSentEvents". I would not expect IE to make any "/signalr/poll" requests, because those requests are only made by the "longPolling" transport.

Also, having a "pending" poll request in the IE F12 tool's network tab is entirely expected. This is how long polling is designed to work. Basically, as soon as a message is received the client makes a new ajax request (a long poll) to retrieve new messages. If no new messages are immediately available, the server will wait (for up to 110 seconds by default in the case of SignalR, not forever) for a new message to be sent to the client before responding to the pending long poll request with the new message.

Can you clarify exactly what issue you are having other than seeing a pending poll request showing up under the network tab? It would also help if you you enabled tracing in the JS client, provided the console output, and showed all the "/signalr/..." requests in the network tab.

查看更多
干净又极端
3楼-- · 2019-08-21 16:29

you can try use EventSource (SSE).

I am using this: https://github.com/remy/polyfills/blob/master/EventSource.js but modified, for SignalR: http://a7.org/scripts/jquery/eventsource_edited.js

I am working with it for one year, SignalR just check for window.EventSource and it works.

查看更多
登录 后发表回答