Reconnecting Issue in Blazor Server

Buddhi - BLUE LOTUS 360 1 Reputation point
2022-12-01T07:39:01.567+00:00

Hi,

We have set up our Blazor server application(.NET7) and hosted it. Often we are getting the below error description and we have to reload the page to make it work. frequently we are getting this issue when we are having worked on the browser tab of a blazor page and if we want to go to another tab for some other work and after comeback to the blazor page, We have been referring to some articles related to the above and we expected after .NET7 new release we can get it sorted out. However, the issue is still there and we are not able to fix the issue yet.

266041-image.png

is it a SignalR connection issue or anything else, can anyone help me regarding this ??

Developer technologies | .NET | Blazor
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 81,976 Reputation points Volunteer Moderator
    2022-12-01T16:22:16.613+00:00

    Chrome is very aggressive about shutting down websockets in tabs that are not currently displayed. After a disconnect, the signal/r hub has a limited lifetime (20 seconds I believe) where reconnects are allowed. Once the signal/r times out the connection, the client app has no way to reconnect. See:

    https://learn.microsoft.com/en-us/aspnet/signalr/overview/guide-to-the-api/handling-connection-lifetime-events

    This is just a disadvantage of the blazor server design.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.