I have an AngularJS application with a .NET Core back-end, using an Nginx server, and I'm using the following front-end SignalR library:
https://cdnjs.cloudflare.com/ajax/libs/microsoft-signalr/3.1.3/signalr.min.js
The application works fine, however after about 30-40 mins, the following error appears in the console, and the client no longer displays any real-time messages. I need to refresh the browser for it to work again. This occurs on both Chrome and Firefox:
Error: Connection disconnected with error 'Error: WebSocket closed with status code: 1006 ()
I've looked at these questions, but they haven't solved my issue:
getting the reason why websockets closed with close code 1006
SignalR Core - Error: Websocket closed with status code: 1006
I've tried:
Setting the following configuration settings on Nginx
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
Installing a websockets service in Nginx (that seems to at least be giving me a websocket connection - and I've verified that it's using
wss
):Restarting the client hub after it closes:
hub.deviceHub.onclose(async () => { console.log("restarting hub connection after it was closed"); await hub.StartConnection; });
None of this fixes the issue. What could be causing this, and what else could I try?
I have a related question here about the SignalR connection completing failing at the back-end after about 2 weeks - this provides more detail about the way the back-end is set up:
Server-side SignalR connection fails after significant uptime