Can't connect to my Ratchet / WebSocket Server

I’ve been trying to get my WebSocket server (using Ratchet in PHP) running for the better part of the day, I feel like I’ve tried everything and still no luck. When I try and connect to the WebSocket server in JS it just takes ages and then it times out, essentially, the server accepts the connection (I don’t immediately get a connection refused error) but then does nothing.

I’m running a 14.04 Ubuntu with a LEMP stack. I have found loads of nginx configurations to make this work, but none of them worked for me. The strange thing is that it works perfectly fine locally with my Virtual Machine, which is running a LEMP stack as well, with virtually the same nginx configuration. I never needed to configure anything in my nginx to make websockets work.

I’m completely lost, and any help would be really appreciated!


A very basic Ratchet example I’ve been using to test this:

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

I just opened a new droplet, and I also encountered exactly the same issue. Any good luck here? @cupoftea696 or @royboy789?

Hi @cupoftea696 have you found an answer to this… just starting my research down this path and want to know the best droplet setup.