1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-10-31 21:52:59 +00:00
Files
CC-Tweaked/doc/events/websocket_closed.md
Toad-Dev 43101773bb Revert "Remove CC: Tweaked doc files."
Never mind, we needed them for linting the lua doc :)
2022-01-04 18:08:40 -08:00

552 B

module: [kind=event] websocket_closed

The @{websocket_closed} event is fired when an open WebSocket connection is closed.

Return Values

  1. @{string}: The event name.
  2. @{string}: The URL of the WebSocket that was closed.

Example

Prints a message when a WebSocket is closed (this may take a minute):

local myURL = "wss://example.tweaked.cc/echo"
local ws = http.websocket(myURL)
local event, url
repeat
    event, url = os.pullEvent("websocket_closed")
until url == myURL
print("The WebSocket at " .. url .. " was closed.")