Skip to content

WebSocket connection to 'ws://localhost/websocket' failed #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ajfranzoia opened this issue Sep 15, 2014 · 9 comments
Closed

WebSocket connection to 'ws://localhost/websocket' failed #31

ajfranzoia opened this issue Sep 15, 2014 · 9 comments

Comments

@ajfranzoia
Copy link

Hello. I've started the server successfully from console but after loading page it won't connect to the ws. The error message is "WebSocket connection to 'ws://localhost/websocket' failed: Error during WebSocket handshake: Unexpected response code: 404".

The console task seems to be running normaly, this is the output:

[1410805625.7352] Event begin: Rachet.WampServer.construct
[1410805625.7352] Event end: Rachet.WampServer.construct
@ajfranzoia
Copy link
Author

Managed to apparently connect to the server by using port 8080, but looking at the console the websocket shows as "Finished" instead of "Switching protocols".

@WyriHaximus
Copy link
Owner

Hey, regarding your first comment is that if you pass it through a webserver you have to set it up to proxy the websocket connections to Ratchet.

What browser are you using? In chrome you can track websocket connections in the developer console. Can you see incoming connection on the Rachet console?

@ajfranzoia
Copy link
Author

Thanks for promptly answer. Right, I'm using the chrome developer console, I can see the websocket connection being listed, but its status is marked as "Finished".
If I could give you any kind of debug information, just let me know how to do it and I will glady provide it.

@WyriHaximus
Copy link
Owner

Ok but what is on your console, like you quoted on your first comment?

@ajfranzoia
Copy link
Author

This is the full console output

augusto@augusto-cx:/var/www/ratchet-demo/app$ ./Console/cake Ratchet.websocket start -v

Welcome to CakePHP v2.5.3 Console
---------------------------------------------------------------
App : app
Path: /var/www/ratchet-demo/app/
---------------------------------------------------------------
[1410818086.4832] Event begin: Rachet.WampServer.construct
[1410818086.4833] Event end: Rachet.WampServer.construct

@WyriHaximus
Copy link
Owner

So no incoming connection on it, on what port is it running? If you're on linux you can check with: netstat -tulpen | grep php

@ajfranzoia
Copy link
Author

I got it fixed, I was connecting to port 8080 in the client, but Ratchet.Connection.websocket.port config was set as 11001. Thanks for your help!

@WyriHaximus
Copy link
Owner

Cheers, if you have any other questions just shoot 👍 .

@Creemli
Copy link

Creemli commented Oct 29, 2015

Actually I have also seen this error, and the reason is using Safari to debug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants