php - Can't connect to my Ratchet / WebSocket Server -
i've been trying websocket server (using ratchet in php) running better part of day, feel i've tried , still no luck. when try , connect websocket server in js takes ages , times out, essentially, server accepts connection (i don't connection refused error) nothing.
i'm running 14.04 ubuntu lemp stack. have found loads of nginx configurations make work, none of them worked me. strange thing works fine locally virtual machine, running lemp stack well, virtually same nginx configuration. never needed configure in nginx make websockets work.
a basic ratchet example i've been using test this: http://socketo.me/docs/hello-world
i'm lost, , appreciated!
edit:
okay, figured out needed set proxy_pass on different path root path in order work. had this:
location / { proxy_pass http://localhost:1111; proxy_http_version 1.1; proxy_set_header upgrade $http_upgrade; proxy_set_header connection "upgrade"; try_files $uri $uri/ /index.php?$query_string; }
but not changed this, it's working:
location /ws/ { proxy_pass http://localhost:1111; proxy_http_version 1.1; proxy_set_header upgrade $http_upgrade; proxy_set_header connection "upgrade"; } location / { try_files $uri $uri/ /index.php?$query_string; }
however, i'd still configure uses root url, if possible (i mean, should since on local homestead machine work on root path)
i wrote sweet tutorial on short time ago think covers problem having.
basically can't have try_files
, proxy in same location
block. easiest work around causest 0 problems run websocket off subdomain own server definition.
check out tutorial here: http://blog.samuelattard.com/using-nginx-as-a-proxy-for-websocket-connections/
Comments
Post a Comment