Troubleshooting ΒΆ


Q: I followed the Hello World! tutorial and I got it to work in telnet but couldn't get it working in any of the browsers.
A: You missed a step

Q: I'm using App and I get 404's when I try to connect.
A: Make sure the first parameter ($host) of App is the same hostname you use to connect in your JavaScript WebSocket connection. If you need to support multiple hosts the fourth parameter of App::route() lets you specify an alternative $host to the default in __construct.

Q: I'm using App and I get 403's when I try to connect.
A: This is actually a security feature! App, by default, enforces a same origin policy to prevent other web sites from connecting to your server. Either make sure you're opening WebSocket connections in JavaScript from the same URL as your $host in App or to allow another Origin the third parameter of App::route() accepts an array of allowed origins.

Q: I can connect locally but not remotely or when I run on my server.
A: This is also another security feature! By default Ratchet binds to which only allows connections from itself. The recommended approach is to put Ratchet behind a proxy and only that proxy (locally) will connect.
If you want to open Ratchet up (not behind a proxy) set the third parameter of App to ''.