1
votes

I'm logging disconnects in my web game. It seems 75% of the sessions are getting disconnected with the code 1001 (normal) and 25% are getting disconnected with the code 1006 (error). https://tools.ietf.org/html/rfc6455

Sometimes on the error reason I see this text:

CloudFlare WebSocket Proxy restarting

But he majority of 1006 disconnects don't give any reason at all. The players just disconnect with no reason at all. This usually happens at 5-30 minutes mark while the player is actively playing the game.

The setup I'm has these:

My question is:

  1. How can I debug this problem better?
  2. What are common cases which might be causing this problem?
1
1006 indicates that the connection was closed in a nongraceful manner. This will happen when browser (tab?) is simply killed (rage quit? :D). I'm not sure if browser is obligated to send close frame when being closed (I think not). And even if it is I'm pretty sure not all of them do that. Another case is when the connection dies for any reason. For example when mobile goes out of network range. Yes, for mobiles this will definitely happen more often. Anyway I don't see a reason to treat 1006 specially.freakish
It's happening at times when it should not happen, like when the player has a solid network connection, doesn't close a tab, is playing, is winning. (it's a browser pc game) 25% of connections going away like this sounds too much, there is definitely a bug somewhere and I am out of ideas on what to try nextEsqarrouth
How do you know that the user doesn't close tab? Also how big is the traffic over the connection? Is it possible that it's a timeout on some proxy server?freakish
1. When I try to close the tab while testing, I get the error code 1001. 2. Players occasionally send me a screenshot of their screen, and javascript console.Esqarrouth
Are you sure that none of the intermediate servers kill the connection before 30s ping? If so then this might be an ISP/firewall issue.freakish

1 Answers

0
votes

The reason for this specific error is because Cloudflare updates software or configuration of their SSL, Firewall, Nginx, physical servers.

Almost any stack in their system being updated will kick out your websockets. You have 2 solutions:

  1. Websockets doesn't use Cloudflare
  2. Have an automatic reconnection logic