Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to connect with socket.io using node.js and nginx
    primarykey
    data
    text
    <p>I've set up a socket.io with node.js running behind nginx. The main domain is running on nginx and sub-domain is being proxied to node.js. All the REST APIs are working fine, but when it comes to socket connections, I do see the handshake in the logs, but client is not able to get response apparently. Below is the log from node.js, and further below are the configs I'm using. Any ideas why it's not working?</p> <pre><code>info - handshake authorized 7WtMDKRY1tPb97CORlJ4 debug - setting request GET /socket.io/1/websocket/7WtMDKRY1tPb97CORlJ4 debug - set heartbeat interval for client 7WtMDKRY1tPb97CORlJ4 debug - client authorized for debug - websocket writing 1:: debug - clearing poll timeout debug - jsonppolling writing io.j[0]("8::"); debug - set close timeout for client JoDWOVTvLg7SdYpNRlJ2 debug - jsonppolling closed due to exceeded duration debug - setting request GET /socket.io/1/xhr-polling/7WtMDKRY1tPb97CORlJ4?t=1368925686996 debug - setting poll timeout debug - discarding transport debug - cleared heartbeat interval for client 7WtMDKRY1tPb97CORlJ4 debug - setting request GET /socket.io/1/jsonp-polling/7WtMDKRY1tPb97CORlJ4?t=1368925696997&amp;i=0 debug - setting poll timeout debug - discarding transport debug - clearing poll timeout debug - clearing poll timeout debug - jsonppolling writing io.j[0]("8::"); debug - set close timeout for client 7WtMDKRY1tPb97CORlJ4 debug - jsonppolling closed due to exceeded duration debug - setting request GET /socket.io/1/jsonp-polling/7WtMDKRY1tPb97CORlJ4?t=1368925717060&amp;i=0 debug - setting poll timeout debug - discarding transport debug - cleared close timeout for client 7WtMDKRY1tPb97CORlJ4 debug - clearing poll timeout debug - jsonppolling writing io.j[0]("8::"); debug - set close timeout for client 7WtMDKRY1tPb97CORlJ4 debug - jsonppolling closed due to exceeded duration debug - setting request GET /socket.io/1/jsonp-polling/7WtMDKRY1tPb97CORlJ4?t=1368925737199&amp;i=0 debug - setting poll timeout debug - discarding transport debug - cleared close timeout for client 7WtMDKRY1tPb97CORlJ4 debug - fired close timeout for client JoDWOVTvLg7SdYpNRlJ2 info - transport end (close timeout) </code></pre> <p>Nginx config:</p> <pre><code>upstream app_yourdomain { server 127.0.0.1:3000; } # the nginx server instance server { listen 80; server_name mydomain.com; # pass the request to the node.js server with the correct headers and much more can be added, see nginx config options location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; tcp_nodelay on; proxy_pass http://app_yourdomain/; proxy_redirect off; } } </code></pre> <p>Socket.io is running in 127.0.0.1:3000.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload