Aliases

  • WebSocketObject.send

Arguments

string
required
The input bytes as a binary-safe Luau string.
boolean
default:"false"
Whether to send a binary frame. Invalid UTF-8 text is automatically sent as binary.

Returns

boolean
True when the native send succeeds.
string?
A diagnostic when the native send returns false.
Start a WebSocket server on port 8765 before running the example. Payloads over 16 MiB return false, diagnostic. Invalid UTF-8 text is sent as binary. Type errors can raise. Supports socket.Send(data, binary) as well as colon calls. Related types: WebSocket types & behavior.

Example