Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Blazor Hosted WebAssembly with multiple replicas in kubernetes causing signalr hub issues

$
0
0

I have an application written in Blazor WebAssembly under .Net8. This app is hosted model which means that has a client and server project. For the intercommunication web api is used. The app is using signalr hubs for broadcasting some messages to all users and all user's tabs.

The Server Program.cs file:

    builder.Services.AddSignalR(hubOptions =>    {        hubOptions.ClientTimeoutInterval = TimeSpan.FromMinutes(30);        hubOptions.KeepAliveInterval = TimeSpan.FromMinutes(15);    });    //........    app.MapHub<ChatHub>("hubs/chathub");

On the Client page, under Index razor component:

    hubConnection = new HubConnectionBuilder()        .WithUrl(navigationManager.ToAbsoluteUri("/hubs/chathub"))        .WithAutomaticReconnect()        .Build();

This gives various errors on page loading while replicas are grater than one into Kubernetes cluster, as there would be more server instances, i have done already some experiments:

  1. When using options.Transports = Microsoft.AspNetCore.Http.Connections.HttpTransportType.WebSockets;Then error is: WebSocket connection to 'ws://www,xxx.com/hubs/myhub'failed

  2. When using options.Transports = Microsoft.AspNetCore.Http.Connections.HttpTransportType.ServerSentEvents;Then error is: Unhandled exception rendering component:ServerSentEvents can not be the only transport specified whenrunning in the browser

  3. When using options.Transports = Microsoft.AspNetCore.Http.Connections.HttpTransportType.LongPolling;Then error is: LongPolling failed:net_http_message_not_success_statuscode_reason, 404, Not Found

I am trying to sync messages across servers in order not to centralize the the signalr service (not having a central broker) into an another independent pod. Any ideas?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>