socket signal:wait
Yields the current task until the selected socket signal is delivered. OnMessage returns the message data; OnClose has no message body. Waiting does not create a network timeout.
Syntax
socket.OnMessage:wait() -> ...any
Returns
| Type | Description |
|---|---|
...any | Arguments delivered by the signal. |
Description
These methods operate on the socket’s signal, not on the socket itself. Do not wait for a message that has already arrived before the listener was installed.
Example
local socket = WebSocket.connect("wss://your-server.example/socket")
local message = socket.OnMessage:wait()
print(message)
These are Game executor contracts. Check build requirements and session lifetimes before using them.
