How to detect client disconnected on Async Server?

60 views
Skip to first unread message

Venelin Vasilev

unread,
Oct 10, 2020, 4:23:36 PM10/10/20
to grpc.io

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 ?

Aleksandr Yeganov

unread,
Jan 26, 2021, 10:38:26 PM1/26/21
to grpc.io
Hi Vivas,

Did you ever figure out what the problem was?

Aleks

Reply all
Reply to author
Forward
0 new messages