Connecting to a server created with node.js with socket.io

Hello,

I had a working project that I came back to try add things, to find out that it is not working anymore.
I managed to narrow down the problem, and it seems to be that the client can not connect to the server created with socket.io.
To try to figure out what is wrong, I forked the project in the tutorial http://developer.playcanvas.com/en/tutorials/real-time-multiplayer/ , and changged the address the client should connect to by changing a line in network.js to
socket = io.connect(‘http://localhost:3000/’);
(The server.js file I’m using is the same as the one in the tutorial.)
It seems that if I put socket = io.connect(‘http://127.0.0.1:3000/’); , the client connects to my server created by node js perfectly, but if I replace 127.0.0.1 by localhost, it does not work anymore.
I also tried to add this line to my server.js file
var server = http.createServer(function (request, response) {
response.writeHead(200, {“Content-Type”: “text/plain”});
response.end(“Hello World\n”);
});
And I can connect to the page on my browser with both http://127.0.0.1:3000 and http://localhost:3000.
So, I assumed that there is some problem with using localhose with socket.io but I can not figure out what is wrong.
Since the code was working perfectly 2 months ago, I also tried to try the same thing on a different machine but it is still not working. I assume that it could be something that changed in socket.io or in my network, but I am having a hard time figuring out what. Could someone help me with this?