I'm trying to make my node application working on heroku, and i stumble upon a, i'm sure common problem, but, i can't sort it out.
my project is a 3 part system, composed of :
- a server file running express and socket.io
- a "web app" in the public folder of the express node server
- a stand alone node app, runned on my comp, linked to an arduino board
on my computer everything runs fine, since everybody listen to the node server from the same ip/port. but in herku since the port is dynamic, i can't get the two other components to know where to connect to.
i define my port like this :
var port = process.env.PORT || 5000;
and log the port on server up via a console.log statement.
after checking my logs a few time, and then looked at the heroku doc, i realised that i can't have a static port on heroku.
So i'm kind of lost on how can i get the two other component to get heroku port.
side note : here are the solution i will try to implement if i can't get it to work
- separate the web server and the io server so i can listen to the IO server itself, this solution IS working, but i would prefer having only one heroku instance running for that
- make the io server listening to the express server event, it should work ... but this is not solving the issue for the part on my computer.
- jump of a big bridge, resolve no issue, but will make the issues less important.
thanks for the time you spent reading my existentials problems, and thanks in advance for the help