I looked into your issue. I was able to verify that the error is showing up in the console when I open the link you posted. There’s no settings needed to make WebSockets work for apps deployed on Render.
According to this StackOverflow post I found, can you take a look at how you’re establishing the WebSocket connection? Potentially, close() might be called before the connection is established. One experiment you could do is move the close() call to a different location or initially omit it altogether to see if the same error is occurring.
I’ll have a look at it and see if makes things better. The strange problem is that the exact same stack deployed locally or to a droplet on DigitalOcean all works fine. Makes me think there might be something happening at the proxy level directing traffic to our app.
That’s definitely strange that it works fine deployed to a droplet on DigitalOcean.
If the issue doesn’t go away, would you mind creating a minimal repro that we can use to investigate? An express app with a single websocket endpoint and a one-page app that only tries to connect to that endpoint would be ideal.
I took a look at your service and tried deploying an Action Hero of my own at: https://actionhero-test.onrender.com/ and was able to have to get it successfully running without the web socket errors.
A few things to try:
Set your build command to: npm install && npm run build
Set your start command to: npm run start
Probably un related but it seems that your Redis instance ended up running on port 10000 instead of 6379. Can you add an environment variable to that service PORT: 6379 which will force Redis to redeploy and use that port.
Thanks for the feedback @Sean_Doughty!
I can see the app building and starting OK in the logs, and I can confirm that it’s properly connected to redis (the app crashes and doesn’y boot otherwise). The REST api parts of the app all work OK (eg Actionhero.js Swagger Documentation).
When checking out your version, I see quite a few problems with the API (nothing loaded on the homepage for instance).
I’m curious if the deployment type matters - I did a web service
This is going to sound nuts - but I’m pretty sure that the new versions of the app I’m deploying are not what’s being served up on https://demo-actionherojs-com.onrender.com/. The logs don’t show any requests, and they should.
Can you correlate a deployment with a URL?
(I’m not allowed to post more comments, so I keep editing this one)
I was able to replicate the error you are having when using the Free plan. We are taking a look to see why this is the case.
Update:
We are looking at why the web sockets are not working with our Free Plan and we will pick up this thread early next week. In the meantime, you could try running your api on the Starter plan.
Yeah I’m also getting this on Phoenix. Works flawlessly with a local release but when deployed I get an error. Everything else on the platform is working well.
I’m using node js web socket and my connection is establish in starting but after few minutes it loss the connection and reconnect
I’m using render free plan how can i make web sockets in node js???
I also am having websocket issues. I seem to be unable to use WSS. I hoped Render would forward WS to WSS. Even now my server supports WSS, it doesn’t have certificates so cannot use WSS.
Any plans on this @Sean_Doughty?
Really want a websocket backend for my portfolio and was planning to have it hosted on Render, but it seems like I can’t use Render if I can’t use WSS as https doesn’t allow WS.