I figured it out. I transformed this service to use the asyncio api and 
used the `Context.write` method. It works beautifully! Unbelievable! What a 
great library. Thank you!

On Thursday, January 25, 2024 at 4:06:10 PM UTC-8 Eric Chamberlain wrote:

> I am trying to perform one operation, where the operation may send 
> multiple messages to the client to inform them of the operation's status. 
> The operation is wrapped in an `asyncio.run` context. So I need to be able 
> to send messages _while in the context of the asyncio operation_. Yes, I 
> understand this blocks other requests from being processed. This is OK for 
> this use case.
>
> I was hoping that the `grpc._server._Context` had something like `send`, 
> or `write`, which accepted a streaming object. Alas, `yield` is used. I 
> don't have an iterator, and there's no way to untangle the operation with 
> an iterator that lives outside of the operation. I'm hoping there's some 
> API feature I'm missing.
>
> Maybe if I use the Asyncio API (
> https://grpc.github.io/grpc/python/grpc_asyncio.html#grpc.aio.ServicerContext.write)
>  
> it would do what I want to do?
>
> Thank you!
>
> Eric
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/35398bf1-d54d-43cb-b237-e04f0bfd362cn%40googlegroups.com.

Reply via email to