vmagamedov / grpclib

Pure-Python gRPC implementation for asyncio
http://grpclib.readthedocs.io
BSD 3-Clause "New" or "Revised" License
936 stars 92 forks source link

Pub/Sub using stream RPC #147

Closed quazzuk closed 2 years ago

quazzuk commented 2 years ago

Hi

I'm just wondering if it's possible to support a pub/sub like setup using streams?

I was hoping I could store the stream and send_messages back to the client after the initial call has exited but this fails with a h2.exceptions.StreamClosedError on the server side. Are there any ways to keep the stream alive beyond the scope of the initial call?

I suspect my problem is due to [this](https://github.com/vmagamedov/grpclib/blob/add8f4852c67a31da15c6647624d444ba3e16bcc/grpclib/server.py#L290) as if I hack it by setting `stream._cancel_done = True` inside the server message before storing the stream object it "works". Thanks