What is the best way to detect when a client has disconnected?

I’m looking for a reliable hook on the server end to determine when a client is no longer reachable/responding, so I can update the clients that are still connected accordingly. I say reliably, because I’m just unsure on whether or not a client will tell the server if it has disconnected when someone, for instance, ends the process through task manager/-kill.

Also, when a client DOES use client.close(), is this captured on the server somewhere? I couldn’t see any logger output when I did this. Thanks in advance for the help, and hopefully this is an easy one!