-
Notifications
You must be signed in to change notification settings - Fork 9.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SignalR WebSocket Connectivity Issue in FireFox #48305
Comments
2023-5-19_v1.2.zip |
I have also just started seeing something very similar to this if not the exact issue. It's on an airgapped network that I can't provide a trace from though. Will also point out that this is Firefox 114.0.2 on a linux host (Pop_Os! 22.04). |
This happens to me rather often, as Firefox on Windows 10 is my primary browser. Once the glitch appears on http://localhost:3000, it usually persists across different tabs until the browser is closed & restarted. Something peculiar about the "WebSocket failed to connect" message is that it doesn't appear on initial page load, it appears during reload, and when it appears it is always the very first message; notably, it appears before the constructor for But is it just a SignalR thing or are all websockets broken? Well, SignalR connections on different domains still work, so the problem is limited to a a particular domain, and maybe localhost only. I found that if I ran this code on Chrome:
It immediately prints "Connection established". Running the same code in Firefox (in its "glitched" state), nothing happens (neither success nor error). So SignalR seems blameless. However, the SSE fallback doesn't happen after 1-2 minutes; it takes about 13 minutes and 20 seconds (800 seconds) which seems excessive! This is with @microsoft/signalr v6.0.7. When it finally does establish an SSE connection, something goes wrong and the connection fails afterward. The console output looks like this:
Note 1: After the "SSE connected" message, it pauses for a few seconds before the next message appears. It looks like the server (Microsoft.AspNetCore.SignalR.Core.dll in dotnet\shared\Microsoft.AspNetCore.App\7.0.7 folder) is rejecting the SSE connection attempt, but I don't know why. I haven't added any configuration to disable SSE (I just call |
The more logs the better, here are docs on getting server and client logs: https://learn.microsoft.com/aspnet/core/signalr/diagnostics?view=aspnetcore-7.0 (trace is the most verbose) |
Please find my detailed logs below. We are using Authorization, I kept the Auth logs in place, to see that there is no general timing issue in network communication. hope this helps |
Could someone meanwhile find the time to check the logs? Is there anything else required to tackle the issue? |
Is there an existing issue for this?
Describe the bug
I am getting "Error: Failed to start the transport 'WebSockets': Error: WebSocket failed to connect" while using SignalR in an Angular application with .NET 6.0. The issue occurs specifically in Mozilla Firefox and it's random. Despite attempting to refresh the page, the problem persists. However, closing and reopening the browser resolves the issue.
After approximately 1-2 minutes of being stuck in the "connecting" state, SignalR throws an error and automatically switches its transport protocol to Server-Sent Events (SSE), following which the connection successfully establishes.
The WebSocket connection is working fine in Chrome
Expected Behavior
Like Chrome a websocket connection should be established in Firefox as well.
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
.Net Version: 6.0.3 Signalr Version: 6.0.3
Anything else?
The text was updated successfully, but these errors were encountered: