From 2aeb8b5deacfa1f1b2c98c91204154bfefb2923a Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 28 Mar 2021 11:32:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dws=E5=BA=93=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=9A=84op=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/websocket.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Zframework/websocket.lua b/Zframework/websocket.lua index 8ac28640..660f0223 100644 --- a/Zframework/websocket.lua +++ b/Zframework/websocket.lua @@ -188,6 +188,14 @@ local OPcode={ ping=9, pong=10, } +local OPname={ + [0]="continue", + [1]="text", + [2]="binary", + [8]="close", + [9]="ping", + [10]="pong", +} function WS.send(name,message,op) local ws=wsList[name] ws.sendCHN:push(op and OPcode[op]or 2)--2=binary @@ -202,7 +210,7 @@ function WS.read(name) local message=ws.readCHN:pop() if op==8 then ws.status="dead"end ws.lastPongTime=timer() - return message,op + return message,OPname[op]or op end end