dotnet / dotnet/aspnetcore

SignalR WebSocket Connectivity Issue in FireFox

Open
#48,305 11 comments 2 reactions 0 assignees View on GitHub
area-signalr
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### 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?

![connecting](https://github.com/dotnet/aspnetcore/assets/130349622/a720231c-fc1d-406a-b31c-fdbf02c0c45f)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.