How do i check that a websocket is still active and has not yet been closed? #2402
-
|
Basically i want a websocket that will automatically try to reconnect when it disconnects because otherwise when i do changes to the server i'd have to restart the cc script aswell |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
You should receive https://tweaked.cc/event/websocket_closed.html event when websocket connection closes. |
Beta Was this translation helpful? Give feedback.
You should receive https://tweaked.cc/event/websocket_closed.html event when websocket connection closes.
Additionally, https://tweaked.cc/module/http.html#ty:Websocket:receive function returns nil and reason it websocket closed while it was waiting for message, and throws if you attempt to call it on closed websocket.
That should cover both pullEvent and recieve() based loops.