修改ws的ping间隔和自我认定掉线时间

This commit is contained in:
MrZ626
2021-05-12 01:44:21 +08:00
parent e3b36c8ad1
commit fe2d34b057
2 changed files with 4 additions and 3 deletions

View File

@@ -243,7 +243,7 @@ function WS.connect(name,subPath,body)
readCHN=love.thread.newChannel(),
lastPingTime=0,
lastPongTime=timer(),
pingInterval=26,
pingInterval=12,
status='connecting',--connecting, running, dead
sendTimer=0,
alertTimer=0,
@@ -269,7 +269,7 @@ end
function WS.setPingInterval(name,time)
local ws=wsList[name]
ws.pingInterval=math.max(time or 1,2.6)
ws.pingInterval=math.max(time or 2.6,2.6)
end
function WS.alert(name)
@@ -348,7 +348,7 @@ function WS.update(dt)
ws.sendCHN:push("")--ping
ws.lastPingTime=time
end
if time-ws.lastPongTime>10+3*ws.pingInterval then
if time-ws.lastPongTime>6+2*ws.pingInterval then
WS.close(name)
end
end