Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

242
Vistas
SignalR disconnecting every few minutes after the tab is backgrounded

I'm using SignalR for communication between a Vue.js frontend and dotnet backend.

When you background the frontend tab after a (seemingly random) amount of time the connection gets disconnected. Because I'm using auto reconnect the socket is then reconnected, but then until the tab is re-focused the socket will continue to get disconnected every couple of minutes putting it in a reconnecting loop.

enter image description here

A few things:

  • Seems to happen in all browsers but Firefox
  • When running both the frontend and backend locally, there's no issue
  • Running the frontend locally but backend remotely does cause the issue
  • Neither application are running on IIS
  • Kestrel timeouts have been set to an hour (just in case)
  • The initial disconnect that causes the reconnects to start looping doesn't happen at a consistent time, just somewhere around the 5-10 minute mark
  • No errors are being thrown by either end

Client side code is extremely basic:

 this.connection = new HubConnectionBuilder()
        .withUrl(this.url)
        .withAutomaticReconnect()
        .build()

Server side code is similarly basic:

 public override async Task OnConnectedAsync()
    {
        //Create client code here

        await base.OnConnectedAsync();
    }

    public override async Task OnDisconnectedAsync(Exception exception)
    {
        if(exception != null) _logger.LogErrorToFile(exception.Message);
        _logger.LogInformationToFile($"Client with id: {GetConnectionId()} disconnected.{GetUsername()}");
        await base.OnDisconnectedAsync(exception);
    }
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Chrome made an update earlier this year that stops connections when they are not in focus after about 5 minutes. The issue/fix that Nirbhay commented is actually for the ASP.NET version (2.4.2) and not compatible with .NET CORE. Here is the issue that was raised for .NET CORE - github.com/dotnet/aspnetcore/issues/31079

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda