I am writing a small game server using Java.
I use TooTallNate-Java-Websockets library to create my websocket server. Everything works when I run my server on localhost , I can connect to it from everywhere.However when I submit my app to Heroku , every time I try to establish a socket connection I get an error ECONNREFUSED (Connection refused).
Worth to mention , that when I am running my app with foreman which is supposed to emulate heroku environment , everything works as it should.
As a port for my websocket server I tried to use 8080 and many others in range between 5000 to 8000.
I can only guess what is going on there on heroku , as logs contain only basic info of http requests.
Please help , I am close to give up :(
EDIT
Here is what I have in my Proc file:
web: ./build/install/my-app/bin/my-app
UPDATE Created a simple abstraction app to showcase the problem: (Tested in foreman of course , and it works in local environment)
- My html/js tester : Testerpage
- My Main java Jetty server : Java Main
- Console error message :
WebSocket connection to 'wss://test-websocket-yan.herokuapp.com:39773/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
$PORT
env var on Heroku? You say you are trying ports between 5000 and 8000. Is that on Heroku? – Foretaste