How to allow Socket IO requests on Amazon EC2 instance?

Viewed 3798

I have a web app running on a Amazon EC2 Instance on port 8080, the webapp while starting, starts a Socket io server listening on port 9092.

in the client file connecting to the Socket io server i have this:

io.connect('http://<IPADDRESS>:9092');  

Unfortunately, this request is getting blocked as shown socket.io requests blocked:

I thought the problem was about inbound rules of my EC2 instance, i therefore allowed traffic for the purpose as shown: Ec2 instance inbound rules

But the requests are still blocked...

NOTE: When my app is hosted locally, everything works fine.

So why is amazon behaving this way and what am i supposed to do to come across this issue?

UPDATE:

netstat -a -n | grep 9092 outputs this on instance:

netstat output on port 9092

Also have a look on what firefox shows me about a request attempt timings:

socketio request timings

2 Answers

The easiest way to establish a socket connection with your server from outside of EC2 is to listen to all the incoming traffic:

server.listen(3000, '0.0.0.0');

This is only recommended for testing and development environment. Do not use this for production.

Related