Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

244
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!