
---@class mqtt_connector_copas*: mqtt_connector
---@type mqtt_connector_copas*
local M = {}

--- Open the network connection.
---@param conn mqtt_connection* Connection parameters and status.
---@return boolean ok Whether it is successful or not.
---@return string? errMsg error message.
function M.connect(conn) end

--- Close the network connection.
---@param conn mqtt_connection* Connection status.
function M.shutdown(conn) end

--- Send data.
---@param conn mqtt_connection* Connection status.
---@param data string data.
---@param i? integer starting position.
---@param j? integer end position.
---@return integer|nil nextIndex Next send location.
---@return string? errMsg error message.
function M.send(conn, data, i, j) end

--- Receive data of specified length.
---@param conn mqtt_connection* Connection status.
---@param size integer Number of bytes.
---@return string|nil data data.
---@return string? errMsg error message.
function M.receive(conn, size) end

--- Set timeout.
---@param conn mqtt_connection* Connection status.
---@param timeout? number timeout period.
function M.settimeout(conn, timeout) end

return M
