diff options
author | Michael Martin <flrgh@protonmail.com> | 2021-12-17 15:04:27 -0800 |
---|---|---|
committer | Michael Martin <flrgh@protonmail.com> | 2021-12-17 15:04:27 -0800 |
commit | 9941d7a382931c2f669fbf6535c2fb2e96380f80 (patch) | |
tree | b847d6b18ed7f7325c82c5fe739ac0368020da90 /meta/3rd/OpenResty/library/resty.websocket.client.lua | |
parent | 4f74c75c6a777f17752178dea8e5a92179db86e0 (diff) | |
download | lua-language-server-9941d7a382931c2f669fbf6535c2fb2e96380f80.zip |
chore: update lua-resty-websocket library annotations
Diffstat (limited to 'meta/3rd/OpenResty/library/resty.websocket.client.lua')
-rw-r--r-- | meta/3rd/OpenResty/library/resty.websocket.client.lua | 75 |
1 files changed, 61 insertions, 14 deletions
diff --git a/meta/3rd/OpenResty/library/resty.websocket.client.lua b/meta/3rd/OpenResty/library/resty.websocket.client.lua index f933c941..c722faf9 100644 --- a/meta/3rd/OpenResty/library/resty.websocket.client.lua +++ b/meta/3rd/OpenResty/library/resty.websocket.client.lua @@ -1,16 +1,63 @@ ---@meta -resty_websocket_client={} -function resty_websocket_client.send_text(self, data) end -function resty_websocket_client.new(self, opts) end -function resty_websocket_client.send_ping(self, data) end -function resty_websocket_client.connect(self, uri, opts) end -function resty_websocket_client.set_timeout(self, time) end -function resty_websocket_client.set_keepalive(self, ...) end -function resty_websocket_client.send_binary(self, data) end -function resty_websocket_client.send_close() end -function resty_websocket_client.send_frame() end -function resty_websocket_client.recv_frame(self) end -function resty_websocket_client.close(self) end -resty_websocket_client._VERSION="0.07" -function resty_websocket_client.send_pong(self, data) end + +---@class resty.websocket.client : resty.websocket +resty_websocket_client = { + _VERSION = "0.09" +} + +---Instantiates a WebSocket client object. +--- +---In case of error, it returns nil and a string describing the error. +--- +---An optional options table can be specified. +--- +---@param opts? resty.websocket.new.opts +---@return resty.websocket.client? client +---@return string? error +function resty_websocket_client:new(opts) end + +---Connects to the remote WebSocket service port and performs the websocket +---handshake process on the client side. +--- +---Before actually resolving the host name and connecting to the remote backend, +---this method will always look up the connection pool for matched idle +---connections created by previous calls of this method. +--- +---@param url string +---@param opts? resty.websocket.client.connect.opts +---@return boolean ok +---@return string? error +function resty_websocket_client:connect(uri, opts) end + +--- Puts the current WebSocket connection immediately into the ngx_lua cosocket connection pool. +--- +--- You can specify the max idle timeout (in ms) when the connection is in the pool and the maximal size of the pool every nginx worker process. +--- +--- In case of success, returns 1. In case of errors, returns nil with a string describing the error. +--- +--- Only call this method in the place you would have called the close method instead. Calling this method will immediately turn the current WebSocket object into the closed state. Any subsequent operations other than connect() on the current object will return the closed error. +---- +---@param max_idle_timeout number +---@param pool_size integer +---@return boolean ok +---@return string? error +function resty_websocket_client:set_keepalive(max_idle_timeout, pool_size) end + +---Closes the current WebSocket connection. +--- +---If no close frame is sent yet, then the close frame will be automatically sent. +--- +---@return boolean ok +---@return string? error +function resty_websocket_client:close() end + +---@class resty.websocket.client.connect.opts : table +--- +---@field protocols string|string[] subprotocol(s) used for the current WebSocket session +---@field origin string the value of the Origin request header +---@field pool string custom name for the connection pool being used. If omitted, then the connection pool name will be generated from the string template <host>:<port>. +---@field ssl_verify boolean whether to perform SSL certificate verification during the SSL handshake if the wss:// scheme is used. +---@field headers string[] custom headers to be sent in the handshake request. The table is expected to contain strings in the format {"a-header: a header value", "another-header: another header value"}. + + return resty_websocket_client
\ No newline at end of file |