How to retrieve current connected state? #68
-
I was looking at the Code and was wondering if there is any way to retrieve the current state of the connection? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hello, there exists an ExitStarted event which fires when OBS is being shut down. You may refer to the events example for usage. As for kicking a websocket session well it seems the ReqClient will throw a I hope that's helpful. |
Beta Was this translation helpful? Give feedback.
-
This is very helpfull! |
Beta Was this translation helpful? Give feedback.
Hello, there exists an ExitStarted event which fires when OBS is being shut down. You may refer to the events example for usage.
As for kicking a websocket session well it seems the ReqClient will throw a
JSONDecodeError
on the next request attempt, which admittedly could be wrapped in a more useful exception. As for the EventClient, it will just hang since recv() is blocking and simply waiting for the next event. I would suggest you rely on the ExitStarted event if you need your client program to be notified of a shutdown.I hope that's helpful.