Socket.io connection via IP address not working

I got a game working with socket.io. It's working fine when playing locally and via my IP address (not LAN but real IP) when connecting via my own computer.

However, when I give my IP and port to someone else, the index HTML page is loaded all fine but the socket.io 'connection' doesn't work.

It displays the error on line 1659 of socket.io.js.

Socket.prototype.handshake = function (fn) {
var self = this
  , options = this.options;

function complete (data) {
  if (data instanceof Error) {
    self.connecting = false;
    self.onError(data.message);
  } else {
    fn.apply(null, data.split(':'));
  }
};

var url = [
      'http' + (options.secure ? 's' : '') + ':/'
    , options.host + ':' + options.port
    , options.resource
    , io.protocol
    , io.util.query(this.options.query, 't=' + +new Date)
  ].join('/');

if (this.isXDomain() && !io.util.ua.hasCORS) {
  var insertAt = document.getElementsByTagName('script')[0]
    , script = document.createElement('script');

  script.src = url + '&jsonp=' + io.j.length;
  insertAt.parentNode.insertBefore(script, insertAt);

  io.j.push(function (data) {
    complete(data);
    script.parentNode.removeChild(script);
  });
} else {
  var xhr = io.util.request();

  xhr.open('GET', url, true);
  if (this.isXDomain()) {
    xhr.withCredentials = true;
  }
  xhr.onreadystatechange = function () {
    if (xhr.readyState == 4) {
      xhr.onreadystatechange = empty;

      if (xhr.status == 200) {
        complete(xhr.responseText);
      } else if (xhr.status == 403) {
        self.onError(xhr.responseText);
      } else {
        self.connecting = false;            
        !self.reconnecting && self.onError(xhr.responseText);
      }
    }
  };
  xhr.send(null); //This is the line 1659.
}
};

Note: All the files are inside a folder on C: drive, not under a User.

Is the problem related to security access? Or something else?

Code for Server + Client

//Server
express = require('express');  
http = require('http'); 
app = express(); 
server = http.createServer(app); 
io = require('socket.io').listen(server);

app.use(express.static(__dirname + '/public')); 
server.listen(3000);
app.get('/', function (req, res) { res.sendfile(__dirname + '/index.html'); });

//Client
<script src="/socket.io/socket.io.js"></script> 
<script>var socket = io.connect('http://192.168.1.161:3000');</script>

Router Configuration http://puu.sh/3ACGz.png

Make sure that your port (for socket.io) is forwarded by your router. And you are using public IP (static).

As well you should remember that most browsers will not allow to connect via WebSockets to another address/port from the page. For security reasons, your IP/Domain and Port should be the same as your IP/Domain and Port you server html and js from.