mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-10-02 08:50:47 +00:00
![Jonathan Coates](/assets/img/avatar_default.png)
References are now written using normal links: You now use [`print`] or [print a string][`print`]) instead of @{print} or @{print|print a string}.
870 B
870 B
module: [kind=event] websocket_failure
see: http.websocketAsync To send an HTTP request.
The [websocket_failure
] event is fired when a WebSocket connection request fails.
This event is normally handled inside [http.websocket
], but it can still be seen when using [http.websocketAsync
].
Return Values
- [
string
]: The event name. - [
string
]: The URL of the site requested. - [
string
]: An error describing the failure.
Example
Prints an error why the website cannot be contacted:
local myURL = "wss://example.tweaked.cc/not-a-websocket"
http.websocketAsync(myURL)
local event, url, err
repeat
event, url, err = os.pullEvent("websocket_failure")
until url == myURL
print("The URL " .. url .. " could not be reached: " .. err)