How to handle host or client disconnection in unity?

I’m using Unity Relay and Unity Lobby in unity 2021.3.3f1.
I would like to automatically make him shut down the Relay and quit the lobby the player when he doesn’t have wifi anymore. I already search about that but I didn’t found anything.

I would like to know how can I know when the player is disconnected to make him go to the main menu and be disconnected from Relay and Lobby (like he doesn’t have anymore relation with the Relay and the Lobby).
But that is for the client as well as for the host, like when the host is disconnected, the lobby is deleted and all the client are kick.

Basically I would just like to know if there is a function to know if the player is disconnected.

Thanks in advance.