diff options
author | sumneko <sumneko@hotmail.com> | 2021-12-21 22:49:59 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2021-12-21 22:49:59 +0800 |
commit | b7344640a0ab9a07551ee5ebc435657b45659553 (patch) | |
tree | 0fef08a7dbb0a115e0e1249b6123fd529cf1fc58 /meta/3rd/OpenResty/library/resty.websocket.protocol.lua | |
parent | c47baf932309a05673b7931fdf6a1be207fb7bc4 (diff) | |
parent | ec4f497aa2624d9dce29e1de0cfd28ecd85e7df3 (diff) | |
download | lua-language-server-b7344640a0ab9a07551ee5ebc435657b45659553.zip |
Merge remote-tracking branch 'origin/master' into multi-workspace
Diffstat (limited to 'meta/3rd/OpenResty/library/resty.websocket.protocol.lua')
-rw-r--r-- | meta/3rd/OpenResty/library/resty.websocket.protocol.lua | 59 |
1 files changed, 55 insertions, 4 deletions
diff --git a/meta/3rd/OpenResty/library/resty.websocket.protocol.lua b/meta/3rd/OpenResty/library/resty.websocket.protocol.lua index 9ef52bbb..c3455969 100644 --- a/meta/3rd/OpenResty/library/resty.websocket.protocol.lua +++ b/meta/3rd/OpenResty/library/resty.websocket.protocol.lua @@ -1,8 +1,59 @@ ---@meta -resty_websocket_protocol={} -function resty_websocket_protocol.build_frame() end -function resty_websocket_protocol.new_tab() end + +---@class resty.websocket.protocol +resty_websocket_protocol = { + _VERSION = "0.09", +} + +--- Websocket op code +--- +--- Defines the interpretation of the payload data. +--- +--- See RFC 6455 section 5.2 +--- +---@alias resty.websocket.protocol.opcode +---| '0x0' # continuation +---| '0x1' # text +---| '0x2' # binary +---| '0x8' # close +---| '0x9' # ping +---| '0xa' # pong + +---@alias resty.websocket.protocol.type +---| '"continuation"' +---| '"text"' +---| '"binary"' +---| '"close"' +---| '"ping"' +---| '"pong"' + +--- Builds a raw WebSocket frame. +---@param fin boolean +---@param opcode resty.websocket.protocol.opcode +---@param payload_len integer +---@param payload string +---@param masking boolean +---@return string +function resty_websocket_protocol.build_frame(fin, opcode, payload_len, payload, masking) end + +--- Sends a raw WebSocket frame. +---@param sock tcpsock +---@param fin boolean +---@param opcode resty.websocket.protocol.opcode +---@param payload string +---@param max_payload_len interger +---@param masking boolean +---@return bytes? number +---@return string? error function resty_websocket_protocol.send_frame(sock, fin, opcode, payload, max_payload_len, masking) end -resty_websocket_protocol._VERSION="0.07" + +--- Receives a WebSocket frame from the wire. +---@param sock tcpsock +---@param max_payload_len interger +---@param force_masking boolean +---@return string? data +---@return resty.websocket.protocol.type? typ +---@return string? error function resty_websocket_protocol.recv_frame(sock, max_payload_len, force_masking) end + return resty_websocket_protocol
\ No newline at end of file |