Websocket断开连接并出现1006错误,没有任何原因 [英] Websocket disconnects with 1006 error, without a reason

查看:2538
本文介绍了Websocket断开连接并出现1006错误,没有任何原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在记录网络游戏中的断开连接.似乎75%的会话已与代码1001(正常)断开连接,而25%的会话已与代码1006(错误)断开连接. https://tools.ietf.org/html/rfc6455

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代理重新启动

CloudFlare WebSocket Proxy restarting

但是他绝大部分1006次断开连接都没有给出任何理由.玩家完全没有任何理由断开连接.这通常发生在玩家积极玩游戏的5-30分钟.

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.

我具有以下设置:

我的问题是:

  1. 如何更好地调试此问题?
  2. 哪些常见情况可能导致此问题?

推荐答案

出现此特定错误的原因是因为Cloudflare更新了其SSL,防火墙,Nginx,物理服务器的软件或配置.

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

他们系统中几乎所有要更新的堆栈都会踢出您的websocket.您有2种解决方案:

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

  1. Websockets不使用Cloudflare
  2. 具有自动重新连接逻辑

这篇关于Websocket断开连接并出现1006错误,没有任何原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆