ReferenceNetwork

socket:Send

Sends a message through a WebSocket.

Syntax

socket:Send(data: string, binary: boolean?) -> ()

Also available as

socket:send

Parameters

ParameterTypeDescription
datastringMessage bytes.
binaryboolean?Send a binary frame; defaults to false.

Description

Data is sent as a text message unless binary is true. Binary payloads can contain zero bytes. This operation can yield while the transport accepts the message; it is not a guarantee that the remote application has processed it. A closed socket does not reopen automatically.

Example

local socket = WebSocket.connect("wss://your-server.example/socket")
socket:Send("hello")
socket:Send(string.char(0, 1, 2), true)

These are Game executor contracts. Check build requirements and session lifetimes before using them.