File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -23,11 +23,11 @@ Gateway 的地址需要走 http 接口获取,参见[Gateway](https://developer
23
23
常规连接流程如下:
24
24
25
25
1 . 获取 Gateway
26
- 2 . 连接 Gateway。如果连接失败,回退到第 1 步。
26
+ 2 . 连接 Gateway。如果成功,进入到第3步; 如果连接失败,进入到指数回退,最多重试两次(间隔为2,4) ,回退到第 1 步。
27
27
3 . 收到 hello 包,如果成功,开始接收事件。如果失败,回退至第 1 步。
28
28
4 . 在连接中,每隔 30 秒发一次心跳 ping 包,如果 6 秒内,没有收到心跳 pong 包,则超时。进入到指数回退,重试。
29
29
5 . 先发两次心跳 ping(间隔为 2,4),判断连接是否成功。如果成功,则连接恢复。
30
- 6 . 如果不成功,再回退到第 2 步,尝试两次 resume(间隔为 8,16)。如果成功,会按正常往下走,但有一个 resume 过程(同步中间的离线消息),resume 完了,会收到一个 resumeOK 包。
30
+ 6 . 如果不成功,再回退到第 2 步,尝试两次 resume(具体参考下文关于重连, 间隔为 8,16)。如果成功,会按正常往下走,但有一个 resume 过程(同步中间的离线消息),resume 完了,会收到一个 resumeOK 包。
31
31
7 . 如果失败,再回到第 1 步,尝试无数次获取 Gateway(指数倒退,最大间隔为 60),直到成功为止。
32
32
8 . 任何时候,收到 reconnect 包,应该将当前消息队列,` sn ` 等全部清空,然后回到第 1 步,否则可能会有消息错乱等各种问题。
33
33
You can’t perform that action at this time.
0 commit comments