I'm working on a socket app in node.js, I'm using it to make a remote controller.
I need to know in which IP the server is running so Socket.io can connect to it. I have already done it in the app using node.js but now I need to pass it to the html page where the server is running.
This is my javascript on the html page:
<script type="text/javascript">
var socket = io.connect('http://' + /*IP*/ + ':3340', { 'forceNew': true });
function addMessage(e) {
socket.emit('new-message', e);
return false;
}
</script>
Is there any way I can check in which address is the server runnig only using javascript on the html page?
Localhost doesn't work since I want to access it from my mobile or another computer, I can't access to the .js file where I got the IP before and I want it to be as automated as possible so the user has only to connect to an url and not be looking for his local IP.
Thank so much.