I'm doing a real time application with jxcore (nodejs for Plesk Panel) and I'm new on nodejs. Application file index.js is running on domain mydomain.it:
var socket = require( 'socket.io' );
var express = require( 'express' );
var http = require( 'http' );
var app = express();
var server = http.createServer( app );
var io = socket.listen( server );
io.sockets.on( 'connection', function( client ) {
  client.on( 'message', function( data ) {
    io.sockets.emit( 'message', {
      name:data.name,
      surname:data.surname
    });
  });
});
server.listen( 8080 );
On the same domain there is a client page, for example mydomain.it/app, that includes:
<script src="../node/js/bootstrap.js"></script>
<script src="../node/js/node_modules/socket.io/node_modules/socket.io-client/dist/socket.io.js"></script>
<script src="../node/js/nodeClient.js"></script>
This is my nodeClient.js file:
var socket = io.connect( 'http://mydomain.it:8080' ); 
socket.on( 'message', function( data ) {
  var obj = {
    name:data.name,
    surname:data.surname
  }
  // do something
});
Now, I need to connect to the websocket from an Android app, installed on several devices. So there is a domain that contain a nodejs server and a client. And other remote android devices (with an html5 app, developed with jquery mobile). But I can't connect to the socket, it returns errors (ERR_CONNECTION_TIMED_OUT on chrome browser).
From the client page on the domain I can connect to the socket only if I change
var socket = io.connect( 'http://mydomain.it:8080' );
to
var socket = io.connect( 'http://127.0.0.1:8080' ); 
But of course I can't connect to the server from remote devices using localhost. Socket.io is installed only on mydomain.it
Is it possible to realize this kind of application?
Thanks