继续推进联网,实现接入stream和老代码的更新

This commit is contained in:
MrZ626
2021-04-05 20:49:17 +08:00
parent 14302d0106
commit 046a41177f
3 changed files with 56 additions and 50 deletions

View File

@@ -62,8 +62,8 @@ do--Connect
else
res,err=SOCK:receive(ctLen)
if not res then readCHN:push(err)return end
local reason=JSON.decode(res)
readCHN:push((code or"XXX")..":"..(reason and reason.message or"Server Error"))
res=JSON.decode(res)
readCHN:push((code or"XXX")..":"..(res and res.reason or"Server Error"))
end
end
SOCK:settimeout(0)
@@ -175,8 +175,8 @@ while true do--Running
readCHN:push(op)
SOCK:close()
if type(res)=="string"then
local reason=JSON.decode(res)
readCHN:push(reason and reason.message or"WS Error")
res=JSON.decode(res)
readCHN:push(res and res.reason or"WS Error")
else
readCHN:push("WS Error")
end