Multiple child websockets servers

my main render node server receives a /create/:id request and has to create a child websockets server process(isolated because of state) of a given id such that ws clients elsewhere can establish a connection/socket to any of those ws servers by their id.

since I cant expose multiple ports how do I do this

this isn’t the problem of integrating socketio to the http server

“static sites and Free web services are not on a private network”(from docs)

would the clients be able to connect to sub servers on different ports if I was a paid user and used static sites service
is it a private network thing

Hi there,

I think you would need to run a proxy process when you could proxy the requests coming to the child web socket service. The proxy would listen on the publicly exposed port, and then send the quests to the backend process. Maybe you could use http-proxy-middleware for this.

Note that your options for running this on the free tier will be limited. If you expect to be running a child websocket server for every connected client, you will run out of resources pretty quickly.

I’m not sure what isolated state means in your scenario, but have you considered using a separate service to store the client state? For example Redis?


Render Support, UTC+10 :australia:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.