Question

I have a slight problem with use of Node.js and socket.io on Heroku. It works fine locally but as soon as I push it to Heroku and go on the website it gives me the application error page. Looking at the logs there is no explicit error but I have a feeling what it might be. When I run it locally, I use sudo node server to start the app. Just node server gives the same effect as that on heroku.

So basically, my question is: How do I get Heroku to run in sudo mode, or how can I remove the need to use sudo altogether?

Apologies as this is my first time using socket.io, so I am a bit unfamiliar with the workings of the library.

P.S. I am using Express 3.

Was it helpful?

Solution

I would check into the port you are using. On a normal ubuntu machine for example you may have to use sudo for low numbered ports (such as port 80). Besides that Heroku has a lot of load balancing going on, so the port you will use to connect to the service may not be the same as the port you tell the instance to listen on.

I would try using port 5000 as per this example from Heroku Nodejs with sockets

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top