I have a Node Express App which I’ve deployed according to the docs. The server has a WebSocket endpoint and everything works fine locally. When we deploy the app it is hit and miss whether we can connect to the server via our one-page app (also deployed to Render). The error we see in the browser console is:
WebSocket connection to 'wss://chat-server-a1mm.onrender.com/chat' failed: WebSocket is closed before the connection is established
When we run our one-page app locally and connect to the server we see the same error. Deploying the Express App to a Droplet and connecting to it everything works fine. We deployed the app as a Docker container to see if it behaves any differently but we got the same result.
Are there any other settings we need to enable to get WebSockets to work more reliably? Any suggestions on how to debug this further? At the moment it feels like the issue is between our deployed Express App and the load balancer (or proxy) in front of it.