Hacker News new | ask | show | jobs
by Corrado 5590 days ago
I built some WebSocket code that calls back to the server. I can't hardcode the "server" ip address because I want to deploy it to different places at different times. Sometimes I'm working on my laptop, sometimes its running on Amazon EC2, etc. So, with something like this I am able to build my Javascript so it always knows how to get back to the server.

<yea, I know there are lots of ways to do this, but this is the one I chose. :) sue me. >

1 comments

So myipinjosin returns the server's IP address? I thought it would return the clients IP address. (Link is broken atm).

For your use case, relative URLs seem the better solution?