socket signal:once
Subscribes a callback for one signal delivery, then removes that listener. Useful for a single response or one close notification. Register it before triggering the operation that should deliver the signal.
Syntax
socket.OnMessage:once(callback: function) -> Connection
Parameters
| Parameter | Type | Description |
|---|---|---|
callback | function | Handler called on signal delivery. |
Returns
| Type | Description |
|---|---|
Connection | Listener connection. |
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")
socket.OnClose:once(function()
print("Socket closed")
end)
These are Game executor contracts. Check build requirements and session lifetimes before using them.
