增加WEBSOCKET支持

This commit is contained in:
a158
2026-08-04 20:09:14 +08:00
parent 6955e47278
commit f440181f86
2 changed files with 60 additions and 0 deletions

View File

@@ -1,6 +1,40 @@
local M = {}
--[[
FUNCTION 发送响应头
PARAM
state_num 状态码
state_desc 状态描述
--]]
function M.send_header(state_num, state_desc)
return fw_response:send_header(state_num, state_desc)
end
--[[
FUNCTION 发送WebSocket数据
PARAM
data : 数据
opcode : 帧类型(可选默认文本12二进制 8关闭 9ping 10pong)
--]]
function M.send_ws(data, opcode)
return fw_response:send_ws(data, opcode or 1)
end
--[[
FUNCTION 响应结束
--]]
function M.response_done()
fw_response:response_done()
end
--[[
FUNCTION 是否已响应
--]]
function M.is_response_done()
return fw_response:is_response_done()
end
--[[
FUNCTION 发送字符串
PARAM