I have a beautiful full stack app with NodeJS on the server side and ReactJS on the client side. The app relies on Socket.IO package, both Server and Client API.
On my computer, everything works fine on localhost 4000 for node and localhost 3000 for react. Perfect communication on every socket events. But in the future, my set up will be a bit different.
I want to host the server side code on one server, called here SERVER_A, and the client side code on another server, called here SERVER_B, acting like a gateway for the users. What I would expect is a client would open http://SERVER_B:80/myapp on he's personal computer, my react app would open and all of the socket communication would be done internally between SERVER_B and SERVER_A, leaving the client with the data emitted by the node app. But what really happens is, the user on he's personal computer needs to reach both port 80 of SERVER_B and port 4000 of SERVER_A for the entire app to run properly.
This is a bummer because this type of communication should be done under the hood. Is there any way I can restrict the socket listen and emit events between Node and React and keep the client with the rendered data only?
Hope this was clear and sorry for the noobness... :)
Thanks in advance!