socket:Close
Closes the socket.
Syntax
socket:Close() -> nil
Parameters
This function takes no parameters.
Returns
| Type | Description |
|---|---|
nil | This function does not return a value. |
Description
socket:Close is part of the WebSocket library. WebSocket helpers manage a client connection: opening, sending, polling and closing, with message callbacks.
The operation is performed immediately using the arguments supplied at the call site.
The aliases socket:close() resolve to the same implementation.
Example
local ws = WebSocket.open("wss://echo.websocket.events")
ws:Close()
Notes
- Aliases:
socket:close(). - Keep message callbacks short; they run on the module's networking thread.