walkor / phpsocket.io

A server side alternative implementation of socket.io in PHP based on workerman.
2.3k stars 507 forks source link

Client side not connecting? #251

Open carlo-fontanos opened 3 years ago

carlo-fontanos commented 3 years ago

Hi,

I am trying to run on my server (Centos 7), but I get the following error:

image

net::ERR_CONNECTION_TIMED_OUT

I have enabled public access to port: 2120 using the following :

firewall-cmd --zone=public --add-port=2120/tcp --permanent
firewall-cmd --reload

But still not working. Any solution please?

The code works in my localhost.

walkor commented 3 years ago

Security group?

carlo-fontanos commented 3 years ago

Hi, I'm not sure what you mean by Security group, how do I check that please?

walkor commented 3 years ago

For example, if you use aws you should config your securityGroups. https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html

carlo-fontanos commented 3 years ago

Hi, thank you for your reply. I am not using AWS. I purchased my VPS from ionos.com. I installed Centos 7 OS in it.

You can see below that that the port 2120 is open in firewall.:

image

I am not sure why my client side is not able to connect., the server side is able to send message properly.

<script src='https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.1/socket.io.min.js'></script>
<script> 
var socket = io('http://' + document.domain + ':2120');
</script>

Any other recommendations please?

walkor commented 3 years ago

I can't help more. It looks like a server network problem, and I think you should go to ionos.com ask for help.

binemmanuel commented 2 years ago

In my case @carlo-fontanos I had to do an extra work, I used a proxy on my apache configuration to get things up and running. I don't know if the could the same for you.