Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

GaryC's avatar
Level 6

Socket.io timeout

I am trying to get socket.io to work on my remote server but it I keep getting a timeout error. I have changed my connection, like so:

var ioconnection = 'http://[remote-ip-address]:3000';

But I get this status: (failed) net::ERR_CONNECTION_TIMED_OUT

Has anyone else experienced this / have any suggestions? I'm using Digital Ocean Nginx.

Appreciate any help,

Gary

0 likes
8 replies
bashy's avatar

Have you managed to test it with telnet?

telnet <ip> 3000
GaryC's avatar
Level 6

I just tried it and it says unable to connect to remote host. Do you think I should restart the server?

willvincent's avatar

Either your node server is not running/not accepting connections or the port is blocked.

Restart the node server first and see if that resolves your issue, if it does not, you'll likely need to update firewall config.

GaryC's avatar
Level 6

The node server is defo running; I've started / restarted it several times. I'm not really sure how I'd go about updating the firewall config.

willvincent's avatar

And you're certain the node server is listening on port 3000?

Here's some info on opening ports: http://www.daveperrett.com/articles/2006/08/16/opening-a-port-on-linux/

The short answer is: sudo iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 3000 -j ACCEPT but that won't persist after a reboot.. refer to the link above to make that change persistent... but I'd probably just run that command on its own first to see if that gets it opened up for you.

bashy's avatar

5+ hours to not check any firewalls? :D Next time you'll know what to check at least.

Please or to participate in this conversation.