Support Websocket Server on different port?


#1

Hi guys!

I believe this has been asked before, but it would be awesome to have the ability to use both the HTTP port (3000, reverse proxied from port 80/443) but also a secondary port for something else - like port 8080, for instance.

The idea is that websockets are a great way to develop front-end applications that don’t rely on long-polling for updates, and at the moment if you have your express.js session running on process.env.PORT, you can obviously not attach a websocket on that same port.

It would be lovely to have such a feature added to Glitch (say, PORT2 ? ) for… well pretty much any reason, either for sockets or for alternative services given by some projects. Any chance for this happening?


#2

You can do this right now in express - if you add a websocket handler, it can run on the same port as your HTTP requests. Routing two separate ports is a stickier problem, so it won’t be happening in the near future, but it’s something we have on our list.