I have a web page containing Javascript code using socket.io to connect to two NodeJS servers (also running the same version of socket.io). The servers are on the same IP, but different ports. The first connection works fine, but the second connection does not seem to work (the on("connect") callback never gets called). Any idea why this might be the case?
I am using Google Chrome 21.0.1180.79 and Firefox 14.01. The code for connecting to the server is similar to:
socket = io.connect("http://server", {port:some_port_number});
socket.on("connect", function() {
// process connection.
});
Thanks
There's no option 'port', you should append it to url (http://server:port). Because socket.io ignores 'port' option so it doesn't connect to the same url again (default). https://github.com/LearnBoost/Socket.IO/wiki/Configuring-Socket.IO