1

I've googled about this for so many days and till now the client (browsers) cannot connect to the server.

But the server can run. I think its because its connected to itself(localhost).

I did find ratchet documentation which says:

If you want to open Ratchet up (not behind a proxy) set the third parameter of App to '0.0.0.0'.

http://socketo.me/docs/troubleshooting

so i tried this in my server.php file. (doesn't work)

$server = IoServer::factory(

        new HttpServer(
            new WsServer(
                new Chat()
            )
        ),

        8180,
        '0.0.0.0'

    );

Next i tried changing the app.php file which located here(doesn't work):

/vendor/cboden/ratchet/src/Ratchet/App.php


 public function __construct($httpHost = '0.0.0.0', $port = 8180, $address = '0.0.0.0', LoopInterface $loop = null) {......

Then,i tried changing the port to something else. again the server can run but the client cannot connect.

I referred all these:

How to run Ratchet remotely or on a server?
How to run Ratchet remotely or on a server?
https://github.com/ratchetphp/Ratchet/issues/394

Someone please help. All I want is for the client to be able to connect to the ratchet websocket which is running on the server.

Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
112233
  • 2,406
  • 3
  • 38
  • 88
  • Is there any firewall running on the server? – Bogdan Stoica Mar 15 '18 at 13:15
  • i think there's firewall running. because when i created a new port for testing, i did unblock firewall. firewall-cmd --zone=public --add-port=XXXX/tcp --permanent – 112233 Mar 15 '18 at 13:18
  • Try disabling the firewall and see if the client can connect... just for testing purposes... also you can do a `netstat -tunlp` to see what processes are listening on what ports on the server – Bogdan Stoica Mar 15 '18 at 13:19
  • I tried netstat -tunlp and saw none connected to the port I'm using for ratchet – 112233 Mar 15 '18 at 13:24
  • it works now, need to restart the firewall – 112233 Mar 15 '18 at 13:51

0 Answers0