how to make client connect to ratchet on live server?

青春壹個敷衍的年華 提交于 2020-01-06 01:31:07

问题


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.

来源:https://stackoverflow.com/questions/49299954/how-to-make-client-connect-to-ratchet-on-live-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!