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!
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.