title: Connecting to a specific Server Ip with Socket.io
body: <p>I have to build a crossplatform web app for mobile devices, so I'm developing it with html, css and js (then it will pass through phonegap or cordova). </p>
  
  <p>My problem is working with socket.io, and my questions are:</p>
  
  <p>1) Can I connect to a specific ip on the client-side?</p>
  
  <p>Instead on having this:</p>
  
  <pre><code> &lt;script src="/socket.io/socket.io.js"&gt;&lt;/script&gt;
  &lt;script&gt;
    var socket = io.connect('http://localhost');
    socket.on('news', function (data) {
      console.log(data);
      socket.emit('my other event', { my: 'data' });
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>I need this, but this doesn't work:</p>
  
  <pre><code>&lt;script src="my-app/folder/js/socket.io/socket.io.js"&gt;&lt;/script&gt;
  &lt;script&gt;
    var socket = io.connect('http://my.server.ip:port');
    socket.on('news', function (data) {
      console.log(data);
      socket.emit('my other event', { my: 'data' });
    });
  &lt;/script&gt;
  </code></pre>
  
  <p>2) On the server side, how can I create a server that listen to connections and messages on its IP?</p>
  
  <pre><code>var io = require('socket.io').listen(80, my.server.ip);
  </code></pre>
  
  <p>In this way, the application's users will connect to my server Ip in which I host the chat service.</p>
  
  <p>I suppose that I'm not in thinking in the right logic of socket.io .</p>