summaryrefslogtreecommitdiff
path: root/meta/3rd/OpenResty/library/resty.websocket.protocol.lua
diff options
context:
space:
mode:
authorMichael Martin <flrgh@protonmail.com>2021-12-17 15:04:27 -0800
committerMichael Martin <flrgh@protonmail.com>2021-12-17 15:04:27 -0800
commit9941d7a382931c2f669fbf6535c2fb2e96380f80 (patch)
treeb847d6b18ed7f7325c82c5fe739ac0368020da90 /meta/3rd/OpenResty/library/resty.websocket.protocol.lua
parent4f74c75c6a777f17752178dea8e5a92179db86e0 (diff)
downloadlua-language-server-9941d7a382931c2f669fbf6535c2fb2e96380f80.zip
chore: update lua-resty-websocket library annotations
Diffstat (limited to 'meta/3rd/OpenResty/library/resty.websocket.protocol.lua')
-rw-r--r--meta/3rd/OpenResty/library/resty.websocket.protocol.lua59
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