reelwebsocket

Functions for creating, managing, and interacting with WebSocket connections, including sending and receiving data, handling events, and connection lifecycle control.

websocket connect(link) -> struct/nil

Creates a WebSocket connection to the given URL. Returns a connection object on success, or nil if the connection fails.

struct send(string) -> bool

Sends a text message. Returns true if successfully queued/sent, false on failure.

struct send_binary(string) -> bool

Sends binary data. Returns true if successful, false otherwise.

struct recv() -> nil/string

Returns next received message, or nil if no messages are available.

struct close() -> void

Closes the WebSocket connection.

struct is_connected() -> bool

Returns true if the connection is currently active.

struct is_closed() -> bool

Returns true if the connection has been closed.

Last updated