ReferenceNetwork

socket:Close

Closes a WebSocket connection.

Syntax

socket:Close() -> ()

Also available as

socket:close

Description

The socket becomes closed and its OnClose signal is delivered. Repeated closes do not create another connection. Stop sending messages once closure begins; use a new WebSocket.connect call if a later operation needs another connection.

Example

local socket = WebSocket.connect("wss://your-server.example/socket")
socket:Close()
print(socket.IsClosed)

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