1
回答
使用Vagrant环境,无法连接 Websocket
利用AWS快速构建适用于生产的无服务器应用程序,免费试用12个月>>>   

baby, 我用英文写哈,

I'm usingVagrantbox using puphpet, the environment is PHP 5.5 + ubuntu 12.04 + apache + mysql. My Vagrant VM ip: 192.168.11.11, local machine hosts points to192.168.11.11 reactphp.dev, and it works.

And, I'm using this code: https://github.com/muuknl/phprealtimechat to test websocket.

Then I visitreactphp.devin my Chrome browser, and I start server script using:php bin/server.php, and after I type in the username I just got the error:

WebSocket connection to 'ws://192.168.11.11:2000/' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT

It works well when I changed the websocket ip to `ws://127.0.0.1:2000/', but why it does not work if I change to my VM's ip address?

举报
添加软件
发帖于3年前 1回/1K+阅
顶部