Unexpected Signalr connection in Firefox

I am using SignalR (with cross-domain request), version 2.3.0 for webchat integrated into ASP.NET site. Everything is working fine. But I discovered weird SignalR connection behavior. When I clicked the chat tab link to download the file, the SignalR connection was disconnected and the onDisconnected method was launched in my Hub class. FireBug will show me the following POST request:

HTTP: // *: 81 / signalr / interrupt transportation = longPolling & ClientProtocol = 1,4 & token = eUpLNitKcmR1d2JhTTRvcHNVZmEwcG1EKzYvMElZbmg4aE5yam9xM3k0dz0_IjAsNGJmOWNhODUtNDU2NS00NWExLWFjMTgtNzgyN2FhZDA2Njg1LGxvY2FsaG9zdCI1 & Position 1 = & connectionToken = hDXe9xIZtmrapjl1LRwtK9B% 2BfYMoeuHka8ctBLaPa0YnjiN9iiFa% 2BvFMBHIGpGH0h8qPEDgGZSRGwjMw3Wm1DJi6cUPtZjLca6% 2FR2576SGksLAj3lnPN1JWIlxMsn8% 2Bf & connectionData =% 5B% 7B% 22name% 22% 3A% 22c% 22% 7D% 2C% 7B% 22name% 22% 3A% 22voip% 22% 7D% 5D, where * is my domain.

It plays in Mozilla Firefox (version 30.0) to port LongPolling or Websocket. How can I solve this problem? Or is it a SignalR or Firefox bug?

+4
source share
2 answers

SignalR GitHub. , Firefox window.onbeforeunload, SignalR .

, $.connection.start window.setTimeout.

SignalR onbeforeunload : $(window).unbind("beforeunload"). , Firefox , , SignalR. SignalR 30 , OnDisconnected Hub PersistentConnection.

+4

workaraound, halter73, , dudeNumber4 connectionid , connectid .

$.connection.hub.disconnected(function () {
    setTimeout(function () {
        $.connection.hub.start().done(function () {
            $("#mySignalRConnectionIdHidden").val($.connection.hub.id);
        });
    }, 3000);  
});
+1

Source: https://habr.com/ru/post/1546868/


All Articles