I am creating a php web application. It have socket feature for chat purpose. I set port 9999 as TCP port. I ran Socket on this port(Using private IP) and it run successfully. Then I created client script to connect to this socket. At my local machine it is working absolutely perfect(When server is running at local machine). Then I moved code to EC2 instance and trying to connect, it automatically disconnected within 1 second. For debugging purpose, I printed resource. Here is outcome :
2017-11-12 11:33:34 | HYBI Response SENT!
2017-11-12 11:33:34 | User has been added to echo
[DEMO] 97 connected
Resources : Array
(
[0] => Resource id #13
[1] => Resource id #97
)
Resources : Array
(
[0] => Resource id #13
[1] => Resource id #97
)
2017-11-12 11:33:34 | Socket accepted
Resources : Array
(
[0] => Resource id #13
[1] => Resource id #97
[2] => Resource id #98
)
[DEMO] 97 disconnected
You can see here resource ID 97 connected and within a sec it got disconnected.
If there is any missing step OR any setting I need to do?