From 0265793a3fb2c1491ac03242689023d58f0f598e Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 21 Jul 2021 00:52:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86socket=E5=BA=93=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/websocket.lua | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Zframework/websocket.lua b/Zframework/websocket.lua index be219b31..dbcc9d94 100644 --- a/Zframework/websocket.lua +++ b/Zframework/websocket.lua @@ -81,7 +81,7 @@ end function WS.alert(name) local ws=wsList[name] - ws.alertTimer=2 + ws.alertTimer=2.6 end local OPcode={ @@ -162,9 +162,7 @@ function WS.update(dt) end elseif ws.status=='running'then if time-ws.lastPingTime>ws.pingInterval then - CHN_push(ws.sendCHN,9) - CHN_push(ws.sendCHN,"")--ping - ws.lastPingTime=time + WS.send(name,"",'pong') end if time-ws.lastPongTime>6+2*ws.pingInterval then WS.close(name) @@ -176,6 +174,7 @@ function WS.update(dt) else ws.status='dead' ws.real=false + WS.alert(name) MES.new('warn',text.wsClose.."线程错误 Thread error") end end