Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Commit 00b3560

Browse files
committed
✨ 加入Keepalive重试逻辑
1 parent 54e593b commit 00b3560

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

inc/socketio.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,15 @@ public function connect() {
7575
});
7676
}
7777
elseif (isset($jsondata[0][1]) && $jsondata[0][1] == "0"){
78-
mlog("[socket.io]节点已掉线");
79-
exits();
78+
if($this->rekeepalive < 3){
79+
mlog("Keep-Alive失败,正在重试({$this->rekeepalive}/3)");
80+
global $kadata;
81+
$this->ack("keep-alive",$kadata);
82+
$this->rekeepalive++;
83+
}
84+
else{
85+
exits();
86+
}
8087
}
8188
elseif (isset($jsondata[0][1]) && $this->IsTime($jsondata[0][1])){
8289
global $kadata;

0 commit comments

Comments
 (0)