3

I have made a Blazor app, which is working well locally. When I put it on the server, quite often (when app uses DB context) I get this error :

Error: Connection disconnected with error 'Error: WebSocket closed with status code: 1006 ()

The user have to refresh the page, which is really annoying. You can't use app working in this way.

I have found a lot of discussions on this error, lot of plans...and almost everything is older than one year. I would expect the solution already, but haven't found anything.

Anyone knows, why is this happening and how to figure it out in the Blazor app? At least to catch this error and wait until the connection is back, so the page is not getting faded?

So far I was able to do only automatic reloading of page by javascript, when I get this error. But anyway, I can't use this solution in production, because the page is down for a second and it doesn't look good. I need to catch it before and keep the page active.

Thank you.

Filip
  • 117
  • 2
  • 8
  • You could make the WebSocket connection from an invisible iframe where its status would be periodically checked and if the WebSocket is broken, then that iframe could be reloaded. Hacky, but it should work while a more elegant solution is figured out and applied. – Lajos Arpad Apr 17 '20 at 17:11
  • @LajosArpad Yes, but you don't have to check it periodically. You can just ask for WebSocket closed with status code 1006 and reload the page. That is only the solution I have. (I have edited the question). But anyway, I can't use this in the production. I need to keep the page active at least. – Filip Apr 20 '20 at 08:10

1 Answers1

0

FYI , Have you check somewhere on the server-side like the logic that use data from DB context or the security/config in the production between IIS server and DB? If you are sure that it's come from the DB context then have you validate by test other possibility like make the test method that have long delay time/or mockup method that return the data to check whether the error still occur?

I once have a really stupid code in an object. but the code is build with no error. But it clash on runtime with no clue relate to the problem.

private string _oh;
public string  oh 
{
    get { return _oh; }
    set { oh= value; // cause infinite loop > should _oh
        }
}

The worst part is that the error throwed is the same message as this question, So I quite sure there is the root clause elsewhere.

Error: Connection disconnected with error 'Error: WebSocket closed with status code: 1006 ()
user3682728
  • 467
  • 3
  • 7