socket.io + heroku port issue

I'm running socket.io 1.0 in a node.js app on heroku. I'm talking to my server through an ionic/angular app that I'm running locally on http://localhost:9107

In my app I'm loading socket.io in the front end like this:

<script src="https://myapp.herokuapp.com/socket.io/socket.io.js"></script>

This loads up fine, but then my app starts throwing errors in the console:

https://myapp.herokuapp.com:9107/socket.io/?EIO=3&transport=polling&t=1413741961075-13 net::ERR_CONNECTION_REFUSED

Notice the port number 9107 I'm using to run my ionic app locally in the browser being used in the socket request later on. I have no clue why socket.io is doing this or how I can get rid of that port in there.

Does anyone know why this happens and how to solve this?

Thanks a lot!

This took me a while to figure out but the solution was simple: I manually added the port :443 to my socket connection and that seems to override the behaviour mentioned above!