socket.io referring to localhost despite being set as a specfic IP

Problem

I'm trying to use web sockets to connect from a Google Chrome browser on my phone to a server running node.js and socket.io.

Using the remote debugging tool in Google Chrome I get this error in the console

Failed to load resource http://localhost/socket.io/1/?t=1368744562638

This happens despite me specifying my internal LAN IP in code for the client like so:

var socket = io.connect('http://192.168.1.3');

Furthermore it seems like the first heartbeat request makes it but starts to fail after that.

The client requests The code runs as expected when running the client on the server.

Problem courtesy of: Kristjan Oddsson

Solution

I am of course a idiot. I had another javascript file that had not been updated to connect to the specific IP I had set and was still set to "localhost".

After updating the host that socket.io should connect to in that javascript file everything is now running smoothly :)

Solution courtesy of: Kristjan Oddsson

Discussion

There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.