I've made a research and it seems that you can directly catch when a client has been disconnected by any reason. However you can tell that client has been disconnected by turning the feature KeepAlive.
So I added the following lines on the server:
builder.AddListeningPort(server_address, grpc::InsecureServerCredentials());
builder.AddChannelArgument(GRPC_ARG_KEEPALIVE_TIME_MS, 2000);
builder.AddChannelArgument(GRPC_ARG_KEEPALIVE_TIMEOUT_MS, 3000);
builder.AddChannelArgument(GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS, 1);
However how can I now detect the disconnect? Just by adding those there is no way to catch the disconnect. There is no example about such scenario. Where should I listen? on `ServerContext` or where and how to exactly detect it ?