I've managed to set up a node.js server, and access it on my local computer (via localhost). However, I can't access it from any other computers on the LAN.
The server is 192.168.1.103, and the client is 192.168.105
I'm using Apache for the web server, and node.js for a chat server on port 8080.
It seems like every time I restart the server, I get a different error. Sometimes I can access 192.168.1.103:8080/socket.ion/socket.io.js from the remote computer, sometimes it crashes the server with an eror, either:
/home/tnewhook/node_modules/socket.io/lib/manager.js:0
(function (exports, require, module, __filename, __dirname) { /*!
^
RangeError: Maximum call stack size exceeded
OR
/home/tnewhook/node_modules/socket.io/lib/manager.js:916
match = req.url.substr(0, resource.length);
the strangest error I've seen so far is a
missing resource (GET http://192.168.1.105:8080/socket.io. error in socket.io.js:1632
Why would socket.io be trying to call itself?
If I'm not mistaken in the client side socket io js there is an hardcoded ip, which explain why this is not working between 2 computers.
To fix this either upload you app on a service provider like dotcloud.com for example or nodejitsu (limited beta access only) the only one supporting websockets.
Or you can for example on both machin edic /etc/hosts
and add on the serveur
myApp.local 127.0.0.1
and on the client
myApp.local 192.168.1.103
For example for a procedent project I was using either a local DNS or dotcloud's to share to the world.
var url = 'http://myapp:8080';
url = 'http://myapp-me.dotcloud.com';
var socket = io.connect(url);