[Bug] Redis SignalR Backplane completely fails InteractiveServer components
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
When using a Redis SignalR backplane (Microsoft.AspNetCore.SignalR.StackExchangeRedis)
Combined with InteractiveServer components, the websocket functionality is **completely broken**, when connection to cache is broken.
This is a **very significant** issue. As you can see from console logs, Blazor thinks it is actually connecting to websocket, but no DOM updates are sent at all. Whole entire socket is rendered useless if there is a disconnection in SignalR Redis backplane.
**This backplane has nothing to do with InteractiveServer components at all**, it is supposed to be the backplane for SignalR Hubs **that are not default ComponentHub for Blazor Server**
Tested with .NET Aspire bringing a local Redis cache down
**I have also reproduced this in Production scenarios on Azure App Service + Azure Cache for Redis**
https://github.com/user-attachments/assets/fddb0315-ff95-413b-a17d-0ee7bd6c2a34
### Expected Behavior
When switching pages in blazor, if there is no websocket connection, recreate one
When using SignalR Redis backplane for Hubs, which have nothing to do with ComponentHub used for Blazor Server, Blazor Server DOM updates should **not fail**
### Steps To Reproduce
```
services.AddRazorComponents()
.AddInteractiveServerComponents()
services.AddSignalR()
.AddStackExchangeRedis(o =>
{
o.ConnectionFactory = async writer =>
{
var connection = await ConnectionMultiplexer.ConnectAsync(configurationOptions);
return connection;
};
});
```
Add this code to any blazor project.
I used "dotnet new aspire-starter --use-redis-cache --output RedisBackplaneIssue" using Aspire 9
### Exceptions (if any)
blazor.web.js:1 [2024-11-15T05:14:58.478Z] Error: Connection disconnected with error 'Error: WebSocket closed with status code: 1006 (no reason given).'.
log @ blazor.web.js:1
aspnetcore-browser-refresh.js:268 WebSocket connection to 'wss://localhost:50120/' failed: Received a broken close frame containing a reserved status code.
### .NET Version
9.0.1
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.