admin管理员组

文章数量:1375833

I am using websocket in my app and everything worked fine when i was using localhost. The problem starts when i changed localhost to my server ip address then i got this error: Error during WebSocket handshake: Unexpected response code: 404

This is my httpd.conf

...

Listen 25.48.63.220:80
Listen 25.48.63.220:8081

...

ServerName 25.48.63.220:80

...

I think that i am able to connect with my server because when i typed wrong ip address i don't get this error.

What else i have to to change ?

I am using websocket in my app and everything worked fine when i was using localhost. The problem starts when i changed localhost to my server ip address then i got this error: Error during WebSocket handshake: Unexpected response code: 404

This is my httpd.conf

...

Listen 25.48.63.220:80
Listen 25.48.63.220:8081

...

ServerName 25.48.63.220:80

...

I think that i am able to connect with my server because when i typed wrong ip address i don't get this error.

What else i have to to change ?

Share Improve this question edited May 13, 2019 at 7:07 Towkir 4,0142 gold badges26 silver badges42 bronze badges asked Apr 3, 2014 at 10:53 Dawid SkrzypczyńskiDawid Skrzypczyński 3111 gold badge4 silver badges17 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 0

404 means Not Found. Probably you are connecting to the wrong place, or you didn't map the port from your public IP address to your local IP address.

I solved this problem. If you are using poser to download Ratchet you need to change constructor in /vendor/cboden/ratchet/src/Ratchet/App.php.

Default __construct should look like this:
 public function __construct($httpHost = 'localhost', $port = 80, $address = 'localhost', LoopInterface $loop = null) {

So you only need to change httpHost, port and address. It works for me :)

本文标签: javascriptWebsocketError during WebSocket handshake Unexpected response code 404Stack Overflow