Kristjan Oddsson
Kristjan Oddsson

Reputation: 343

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

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.

Upvotes: 3

Views: 253

Answers (1)

Kristjan Oddsson
Kristjan Oddsson

Reputation: 343

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 :)

Upvotes: 3

Related Questions