From bb90b64c3f0d8f54d7b5df322224b85a49bf7aef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=8E=E4=BB=94?= <41766775+huahua132@users.noreply.github.com> Date: Wed, 19 Jul 2023 20:01:41 +0800 Subject: [PATCH] =?UTF-8?q?websocket=E6=B7=BB=E5=8A=A0is=5Fclose=E6=96=B9?= =?UTF-8?q?=E6=B3=95=20(#1781)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * websocket添加is_close方法 * 代码优化 --- lualib/http/websocket.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lualib/http/websocket.lua b/lualib/http/websocket.lua index a7e62ea7b..63e04f127 100755 --- a/lualib/http/websocket.lua +++ b/lualib/http/websocket.lua @@ -9,6 +9,15 @@ local socket_error = sockethelper.socket_error local GLOBAL_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" local MAX_FRAME_SIZE = 256 * 1024 -- max frame is 256K +local assert = assert +local pairs = pairs +local error = error +local string = string +local xpcall = xpcall +local debug = debug +local table = table +local tonumber = tonumber + local M = {} @@ -526,5 +535,6 @@ function M.close(id, code ,reason) end end +M.is_close = _isws_closed return M