How to achieve bidirectional flow server-side timeout in gRPC Python?

19 views
Skip to first unread message

Ka Wai Raymond Sze

unread,
Aug 23, 2020, 2:32:08 PM8/23/20
to grpc.io
This is what I would like to achieve....
Client call the bidirectional method, the server side receive the message from client and if the server does not receive any message from client within a specific time interval, abort the connection, this timer would be refreshed once message is received.
I cannot find any example in gRPC Python doing that.

Thanks.

ericgr...@google.com

unread,
Aug 26, 2020, 1:43:01 PM8/26/20
to grpc.io
I think you will have to implement this type of custom timer logic in your Python service handler, and cancel the stream when the timer expires. I'm not sure if we have an example showing server-side cancellation, but you can find a question and answer describing how to do this at https://stackoverflow.com/questions/55160210/python-grpc-cancel-unary-stream-call-from-client-side.

Thanks,

Eric 

Reply all
Reply to author
Forward
0 new messages