Reputation: 423
This code is running fine with the node.js server running locally:
Server:
var client = require('socket.io').listen(3001).sockets;
Client HTML:
<script src="http://localhost:3001/socket.io/socket.io.js"></script>
Client Javascript:
var socket = io.connect('http://localhost:3001');
Then I moved the server.js to my ubuntu server which has node and socket io installed, using the same code, and started it without error.
Clientside I changed the local html/javascript file from localhost:3001 to ServerIP:3001 and it just doesn't work anymore. When I check firebug, I can see it never finishes trying to GET http://ServerIP:3001/socket.io/socket.io.js. It does not fail, just never finishes.
What did I do wrong? Thank you.
Upvotes: 2
Views: 226
Reputation: 5235
This is most likely a firewall issue. Allow connections on port 3001 using the following (if you use iptables)
iptables -A INPUT -p tcp --destination-port 3001 -J ACCEPT
Than try again
Upvotes: 2