加载时连接ws-app

This commit is contained in:
MrZ626
2021-03-28 00:52:39 +08:00
parent 73c5dc56d3
commit 4207d1b03f
2 changed files with 2 additions and 6 deletions

View File

@@ -1112,7 +1112,6 @@ do
]] ]]
function TICK_WS_app() function TICK_WS_app()
local initial=true
local retryTime=5 local retryTime=5
while true do while true do
YIELD() YIELD()
@@ -1142,10 +1141,7 @@ do
elseif status=="dead"then elseif status=="dead"then
retryTime=retryTime-1 retryTime=retryTime-1
if retryTime==0 then return end if retryTime==0 then return end
if initial then for _=1,120 do YIELD()end
for _=1,120 do YIELD()end
initial=false
end
WS.connect("app","/app") WS.connect("app","/app")
end end
end end

View File

@@ -180,7 +180,7 @@ local loadingThread=coroutine.create(function()
--Connect to server --Connect to server
TASK.new(TICK_WS_app) TASK.new(TICK_WS_app)
TASK.new(TICK_WS_user) TASK.new(TICK_WS_user)
TASK.new(TICK_WS_chat) WS.connect("app","/app")
if USER.authToken then if USER.authToken then
WS.connect("user","/user",JSON.encode{ WS.connect("user","/user",JSON.encode{
id=USER.id, id=USER.id,