diff --git a/Zframework/websocket.lua b/Zframework/websocket.lua index ee8cb76a..a4398843 100644 --- a/Zframework/websocket.lua +++ b/Zframework/websocket.lua @@ -63,12 +63,16 @@ do--Connect --Result if ctLen then if code=="101"then - readCHN:push("success") + readCHN:push('success') else res,err=SOCK:receive(ctLen) - if not res then readCHN:push(err)return end - res=JSON.decode(res) - readCHN:push((code or"XXX")..":"..(res and res.reason or"Server Error")) + if not res then + readCHN:push(err) + else + res=JSON.decode(res) + readCHN:push((code or"XXX")..":"..(res and res.reason or"Server Error")) + end + return end end SOCK:settimeout(0) @@ -316,8 +320,7 @@ end function WS.read(name) local ws=wsList[name] if ws.real and ws.readCHN:getCount()>=2 then - local op=ws.readCHN:pop() - local message=ws.readCHN:pop() + local op,message=ws.readCHN:pop(),ws.readCHN:pop() if op==8 then ws.status='dead'end--8=close ws.lastPongTime=timer() ws.pongTimer=1 @@ -342,7 +345,7 @@ function WS.update(dt) if ws.status=='connecting'then local mes=ws.readCHN:pop() if mes then - if mes=="success"then + if mes=='success'then ws.status='running' ws.lastPingTime=time ws.lastPongTime=time diff --git a/parts/language/lang_en.lua b/parts/language/lang_en.lua index a51862cc..bea3f9d3 100644 --- a/parts/language/lang_en.lua +++ b/parts/language/lang_en.lua @@ -91,7 +91,7 @@ return{ accessFailed="Access Denied.", wsConnecting="Websocket: Connecting", - wsFailed="WebSocket: Connection Failed.", + wsFailed="WebSocket: Connection Failed", wsClose="WebSocket Closed: ", netTimeout="Network connection timeout",