2
votes

I have a server side streaming call of sort rpc ListFeatures(Rectangle) returns (stream Feature) {}. How can I cancel the stream from client side or close the channel cleanly?

I have tried context.TryCancel() it does the job, but is it the correct way to close a channel or cancel the stream?

1

1 Answers

0
votes

Yes, that is one way to do this. The downside to this would be that the server might not realize that the client has gone away until it has done a lot of processing, because the server will only know about the disconnect when a write fails.