It seems that it was an Nginx problems. Nginx was dropping socke connection each 60 seconds cos of
proxy_read_timeout which has default value of 60 seconds and affects Websockets.
There is 2 ways
1: make a heartbeat sending some packet eachtime within this 60 seconds to sustain websocket conenction as being active, but this way, suposably, means some intrusion in server and client side peerjs source. Also, my
sicket.io was working fine as
socket.io have out-of-the-box implemented heartbeat.
2: increase
proxy_read_timeout (which i've done, to 86400s), also it seems that
proxy_send_timeout 86400s; also need to be added.
Here's my working (atleast so far) nginx config (it's nginx config from dokku, only application server block)
server {
listen [::]:80;
listen 80;
location / {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Request-Start $msec;
}
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
include /home/dokku/vapp/nginx.conf.d/*.conf;
}
upstream app { server ip:port; }
On Monday, May 4, 2015 at 3:52:01 AM UTC+3, Max Yari wrote: