-2

So I am using socket io and I have successfully deployed the app on localhost.

To connect client side, I am using :

var socket = io.connect(window.location.origin + ":3333");

for scalability. Server side I am using

var express = require("express"),
app = express(),
http = require("http"),
server = http.createServer(app),
io = require("socket.io").listen(server),
request = require("request");

server.listen(3333);
io.sockets.on("connection", function(socket) {
...
});

and I have verified my app is up an running on the server by performing an nmap on :3333.

But I keep getting ERR_CONNECTION_TIMED_OUT on the client.

Any suggestions?

Loveen Dyall
  • 824
  • 2
  • 8
  • 20
  • 1
    Have you checked your firewall? FYI most linux servers have firewall turned on by default. Google "iptables" – slebetman Jun 03 '17 at 06:01
  • Siebetman you're answer was right, I had to add firewall rules to accept the packets explicitly. If you answer the question i'll accept your answer thanks – Loveen Dyall Jun 03 '17 at 14:37

1 Answers1

0

The solution was to add rules to the firewall on the server for the port:

sudo iptables -I INPUT -p tcp --dport 3333 -m state --state NEW -j ACCEPT
Loveen Dyall
  • 824
  • 2
  • 8
  • 20