Class luasql.exasol.Websocket

This internal class represents a websocket connection that allows sending and receiving messages.

Local Functions

luasql.exasol.websocket.create() Creates a new instance of this class that is not yet opened/connected.
luasql.exasol.websocket.recoverable_connection_error(err) Check if the given error received during connection is recoverable, i.e.
luasql.exasol.websocket.connect_with_retry(url, websocket_options, remaining_retries) Create a connection to a websocket url with the given number of retries.

Methods

luasql.exasol.websocket:connect(url, connection_properties) Open a websocket connection to the given URL, using maximum 3 retries if a connection fails.
luasql.exasol.websocket:_wait_for_response(timeout_seconds) Wait until we receive a response.
luasql.exasol.websocket:send_raw(payload, ignore_response) Send the given payload and optionally wait for the response and return the response.
luasql.exasol.websocket:close() Disconnect from the server and close this websocket.


Local Functions

Methods
luasql.exasol.websocket.create() line 20
Creates a new instance of this class that is not yet opened/connected.

Returns:

    luasql.exasol.Websocket the new websocket.
luasql.exasol.websocket.recoverable_connection_error(err) line 32
Check if the given error received during connection is recoverable, i.e. we can try to connect again later.

Parameters:

  • err string the received error

Returns:

    boolean true if we can retry the connection, false if this is a permanent error that does not disappear
luasql.exasol.websocket.connect_with_retry(url, websocket_options, remaining_retries) line 43
Create a connection to a websocket url with the given number of retries.

Parameters:

  • url string the websocket url to connect to, e.g. "wss://host:1234"
  • websocket_options table the options passed to LuWS when opening a socket, see LuWS documentation for details.
  • remaining_retries number the remaining number of retries. If this is 0, there will be no retry.

Returns:

    luasql.exasol.Websocket the open websocket connection

Raises:

an error if connection does not succeed after the given number of retries

Methods

luasql.exasol.websocket:connect(url, connection_properties) line 71
Open a websocket connection to the given URL, using maximum 3 retries if a connection fails.

Parameters:

Returns:

    luasql.exasol.Websocket the open websocket connection

Raises:

an error if connection does not succeed after the given number of retries
luasql.exasol.websocket:_wait_for_response(timeout_seconds) line 87
Wait until we receive a response. This is implemented with busy waiting until wsreceive indicates that data was received.

Parameters:

  • timeout_seconds number the number of seconds to wait for a response

Returns:

    nil or table nil if a response was received within the timeout or an error if the response did not arrive within the timeout or an error occured while waiting
luasql.exasol.websocket:send_raw(payload, ignore_response) line 125
Send the given payload and optionally wait for the response and return the response.

Parameters:

  • payload string the payload to send
  • ignore_response boolean false if we expect a response.

Returns:

  1. string the received response or nil if ignore_response was true or an error occurred.
  2. nil or table nil if the operation was successful, otherwise the error that occured
luasql.exasol.websocket:close() line 149
Disconnect from the server and close this websocket.
generated by LDoc 1.5.0 Last updated 2025-03-06 11:54:17