Heroku and Websockets

Seems Websockets don’t work on Heroku. At least I can’t get them to work and a Google search shows something else needs to be installed. Has anyone got websockets to work on Heroku? If so, what did you have to do?

Heroku says Websockets are supported :man_shrugging:

Can you show your browser’s console? Particularly looking for any Websocket connection errors as they might provide additional clues

Thanks i will investigate further. Maybe it’s because I am on the free plan and the Dyno sleeps when not in use?

Do Websockets work in the first 2 minutes or so?

No they don’t work at all. Even after a new page refresh.

Is there a proxy involved? For example, when I have Apache reverse proxy to node, I need to also add the web sockets protocol.

I am not noticing anything in the browser dev tools. It’s identical in both hosted and local except for the performance. I might try upgrading to the hobby plan and see if that helps. Web Sockets are my main reason for trying Node. If I can’t get those to work, I am wasting mine and everyone else’s time.

Thank you guys so much for your help! Very much appreciated.

If anyone wants to try it out:

https://wapplernodesandbox.herokuapp.com/

Username: test@test.com
Password: test123

Go to the Websockets page.

In my experience, Wapplers Socket.io integration, or socket.io itself never seems to play nicely on things like Heroku or other similar services. I’ve had issues with them when passing through CloudFlare too, though weirdly not other apps that use Sockets, just those made with Wappler.

I’ve only ever managed to get them to work by self-hosting using a reverse proxy.

Does it work fine on localhost? Looks like indeed the WS connection is being closed abnormally (error code 1006)

It’s weird because it only happens once you click the button to update (42)

Putting a link here for future reference:

Thanks @Apple. It does indeed work fantastic on local server. I will go over the websockets docs again. Maybe I have something set up wrong.