In network applications, there is such a thing when a client sends a test message to the server to the client on a timer to check whether it has fallen off. So how is it more logical? To server to client or client to server?
UPD. Details on my application. I'm writing a chat. Simple text chat. And, accordingly, that party who will send messages also checks, thus, whether the receiving party has fallen off. For example, the client sends messages to the server, but if the server is cut down, it will receive an error when it is called, and this is also an indicator that the server has been cut down. And the server, respectively, simply waits to receive a test message and if it does not receive it removes the client from the connected ones. Well, and vice versa if the receiving party is a client