You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have download links on my page, like <a href="/TestSR/Download">Download</a> and they are powered by an ASP.NET MVC4 action 'Download' on the controller 'TestSR'.
public FileResult Download(){vardata= System.Text.Encoding.ASCII.GetBytes("Col1,Col2,Col3,Col4,Col5");return File(data,"text/csv","filename.csv");}
When one of these is clicked in firefox the SignalR connection is aborted and doesn't reconnect/re-establish. Here is the fidler HTTP log
- Page load
GET https://localhost/realtime/negotiate?clientProtocol=1.4&connectionData=%5B%7B%22name%22%3A%22notificationhub%22%7D%5D&_=1404314258162
GET https://localhost/realtime/connect?transport=serverSentEvents&clientProtocol=1.4&connectionToken=qpX3G8BRx%2BmIDP7HyYsiDPT9hyrGH4Af2NEKlPYm9nzIz3enpE1sWyce5a5WTuAZMIHXWDYt0r9CCw0A1rpwUdfymss57wx7mFDSrz2m6qpaJQppDShXY8nbgkx8k4Ox&connectionData=%5B%7B%22name%22%3A%22notificationhub%22%7D%5D&tid=10
GET https://localhost/realtime/start?transport=serverSentEvents&clientProtocol=1.4&connectionToken=qpX3G8BRx%2BmIDP7HyYsiDPT9hyrGH4Af2NEKlPYm9nzIz3enpE1sWyce5a5WTuAZMIHXWDYt0r9CCw0A1rpwUdfymss57wx7mFDSrz2m6qpaJQppDShXY8nbgkx8k4Ox&connectionData=%5B%7B%22name%22%3A%22notificationhub%22%7D%5D&_=1404314258163
- After clicking <a href="/TestSR/Download">Download</a> in Firefox/36.0
- Download dialog appears
POST https://localhost/realtime/abort?transport=serverSentEvents&clientProtocol=1.4&connectionToken=qpX3G8BRx%2BmIDP7HyYsiDPT9hyrGH4Af2NEKlPYm9nzIz3enpE1sWyce5a5WTuAZMIHXWDYt0r9CCw0A1rpwUdfymss57wx7mFDSrz2m6qpaJQppDShXY8nbgkx8k4Ox&connectionData=%5B%7B%22name%22%3A%22notificationhub%22%7D%5D
GET https://localhost/TestSR/Download
SignalR logs
[11:49:49 GMT-0400 (Eastern Standard Time)] SignalR: Client subscribed to hub 'notificationhub'.
[11:49:49 GMT-0400 (Eastern Standard Time)] SignalR: Negotiating with '/realtime/negotiate?clientProtocol=1.4&connectionData=%5B%7B%22name%22%3A%22notificationhub%22%7D%5D'.
GET https://localhost/realtime/negotiate?clientProtoc...CBUFUp7CejAao5iIWNuEWCkgPPanD281&_=1404316188404
[11:49:49 GMT-0400 (Eastern Standard Time)] SignalR: Attempting to connect to SSE endpoint 'https://localhost/realtime/connect?transport=serverSentEvents&clientProtocol=1.4&connectionToken=m2pSiYpOWuf%2FA6dgP53uZ2BDMpKqbmxw9r%2FkXFOQoOLjlc3azDITptSZcm%2F3RT2zxXxXPLfehQTrJ4NASGWYnFjyTLCi%2FayY2sMFcefwaaCn3Yh7wFWurUTGmz4FhNGX&connectionData=%5B%7B%22name%22%3A%22notificationhub%22%7D%5D&tid=0'.
[11:49:49 GMT-0400 (Eastern Standard Time)] SignalR: EventSource connected.
GET https://localhost/realtime/start?transport=server...CBUFUp7CejAao5iIWNuEWCkgPPanD281&_=1404316188405
[11:49:49 GMT-0400 (Eastern Standard Time)] SignalR: Now monitoring keep alive with a warning timeout of 13333.333333333332 and a connection lost timeout of 20000.
[11:49:54 GMT-0400 (Eastern Standard Time)] SignalR: Stopping connection.
[11:49:54 GMT-0400 (Eastern Standard Time)] SignalR: EventSource calling close().
POST https://localhost/realtime/abort?transport=server...NVzwjiP4wkrw3kqnCBUFUp7CejAao5iIWNuEWCkgPPanD281
[11:49:54 GMT-0400 (Eastern Standard Time)] SignalR: Fired ajax abort async = false.
[11:49:54 GMT-0400 (Eastern Standard Time)] SignalR: Stopping the monitoring of the keep alive.
This does not happen in IE11 or Chrome 35.0.1916.153.
Here is the fidler log from chrome
- Page load
GET https://localhost/realtime/negotiate?clientProtocol=1.4&connectionData=%5B%7B%22name%22%3A%22notificationhub%22%7D%5D&_=1404314679153
GET https://localhost/realtime/connect?transport=serverSentEvents&clientProtocol=1.4&connectionToken=pTsLprS5LAAiMp%2FrEmEdUNMXiTE306HvHQExIquTc%2BVqeMA9GG87VSTwvvJx8yj9UJHVnoqISFtTme69Otwf48xeVDr3Wprg02UYOaADTTdg3CCyBlcZK0u7CQKDJ54y&connectionData=%5B%7B%22name%22%3A%22notificationhub%22%7D%5D&tid=10
GET https://localhost/realtime/start?transport=serverSentEvents&clientProtocol=1.4&connectionToken=pTsLprS5LAAiMp%2FrEmEdUNMXiTE306HvHQExIquTc%2BVqeMA9GG87VSTwvvJx8yj9UJHVnoqISFtTme69Otwf48xeVDr3Wprg02UYOaADTTdg3CCyBlcZK0u7CQKDJ54y&connectionData=%5B%7B%22name%22%3A%22notificationhub%22%7D%5D&_=1404314679154
- Click <a href="/TestSR/Download">Download</a> in Chrome
- Download dialog appears
GET https://localhost/TestSR/Download
GET https://localhost/realtime/reconnect?transport=serverSentEvents&messageId=s-0%2C380C&clientProtocol=1.4&connectionToken=pTsLprS5LAAiMp%2FrEmEdUNMXiTE306HvHQExIquTc%2BVqeMA9GG87VSTwvvJx8yj9UJHVnoqISFtTme69Otwf48xeVDr3Wprg02UYOaADTTdg3CCyBlcZK0u7CQKDJ54y&connectionData=%5B%7B%22name%22%3A%22notificationhub%22%7D%5D&tid=4
[11:52:14 GMT-0400 (Eastern Daylight Time)] SignalR: Client subscribed to hub 'notificationhub'.
[11:52:14 GMT-0400 (Eastern Daylight Time)] SignalR: Negotiating with '/realtime/negotiate?clientProtocol=1.4&connectionData=%5B%7B%22name%22%3A%22notificationhub%22%7D%5D'.
[11:52:14 GMT-0400 (Eastern Daylight Time)] SignalR: Attempting to connect to SSE endpoint 'https://localhost/realtime/connect?transport=serverSentEvents&clientProtoco…Ah0rGI&connectionData=%5B%7B%22name%22%3A%22notificationhub%22%7D%5D&tid=1'.
[11:52:14 GMT-0400 (Eastern Daylight Time)] SignalR: EventSource connected.
[11:52:14 GMT-0400 (Eastern Daylight Time)] SignalR: Now monitoring keep alive with a warning timeout of 13333.333333333332 and a connection lost timeout of 20000.
Resource interpreted as Document but transferred with MIME type text/csv: "https://localhost/TestSR/Download".
[11:52:27 GMT-0400 (Eastern Daylight Time)] SignalR: Keep alive has been missed, connection may be dead/slow.
[11:52:34 GMT-0400 (Eastern Daylight Time)] SignalR: Keep alive timed out. Notifying transport that connection has been lost.
[11:52:36 GMT-0400 (Eastern Daylight Time)] SignalR: EventSource calling close().
[11:52:36 GMT-0400 (Eastern Daylight Time)] SignalR: serverSentEvents reconnecting.
[11:52:36 GMT-0400 (Eastern Daylight Time)] SignalR: Attempting to connect to SSE endpoint 'https://localhost/realtime/reconnect?transport=serverSentEvents&messageId=s…Ah0rGI&connectionData=%5B%7B%22name%22%3A%22notificationhub%22%7D%5D&tid=7'.
[11:52:36 GMT-0400 (Eastern Daylight Time)] SignalR: EventSource connected.
I've traced the abort back to this line in jquery.signalR-2.1.0.js line 632:
if(isFirefox11OrGreater){// Firefox does not fire cross-domain XHRs in the normal unload handler on tab close.// #2400_pageWindow.bind("beforeunload",function(){// If connection.stop() runs runs in beforeunload and fails, it will also fail// in unload unless connection.stop() runs after a timeout.window.setTimeout(function(){connection.stop(asyncAbort);},0);});}
Any advice is appreciated, thanks!
Using:
SignalR: 2.1.0 (redis backplane)
Browsers:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
JS setup:
$.connection.hub.start();
The text was updated successfully, but these errors were encountered:
It appears that Firefox fires the window beforeunload event when you initiate a file download, and thus we stop the connection. This isn't completely unexpected as it's a navigation. You can work around this yourself by registering a callback for the connection's close event and manually calling start on it again after a short timeout (e.g. 1 sec).
This is still an issue with FF. In ASP.NET Core 3+, I found the easiest solution is to use the .withAutomaticReconnect() when building the connection (example).
Problem:
I have download links on my page, like
<a href="/TestSR/Download">Download</a>
and they are powered by an ASP.NET MVC4 action 'Download' on the controller 'TestSR'.When one of these is clicked in firefox the SignalR connection is aborted and doesn't reconnect/re-establish. Here is the fidler HTTP log
SignalR logs
This does not happen in IE11 or Chrome 35.0.1916.153.
Here is the fidler log from chrome
I've traced the abort back to this line in jquery.signalR-2.1.0.js line 632:
Any advice is appreciated, thanks!
Using:
SignalR: 2.1.0 (redis backplane)
Browsers:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.153 Safari/537.36
JS setup:
$.connection.hub.start();
The text was updated successfully, but these errors were encountered: