Hi,

is there something else I can add to clarify my issue?
Why would the client crash because of the server responding to 2 different 
calls at the same time (or maybe something else is going on)?

Thank you

Le vendredi 16 septembre 2022 à 15:44:17 UTC+2, Christophe Calmejane a 
écrit :

> Hi,
>
> I'm experimenting gRPC in c++ and I'm not sure what I want to achieve is 
> possible with the framework.
>
> I need:
>
>    1. a single connection btw the client and the server
>    2. the client to be able to send multiple requests to the server from 
>    different threads (sync or async is fine)
>    3. the server to be able to send messages to the client at any time 
>    (observer pattern)
>
> So what I implemented is the following:
>
> I declared a "registerObserver" RPC in my proto file, as well as some 
> unary commands.
>
> On the server side (not in callback mode), when I receive the 
> registerObserver command, I store the grpc::ServerWriter and don't return 
> from the method until cancelled by the client. Whenever another server 
> thread needs to send a message to the client, it just uses the stored 
> ServerWriter.
> For the unary commands, I simply handle them inline and return the status 
> immediately.
>
> On the client side, I created a grpc::ClientReadReactor to handle the 
> stream of messages from the server, and sync/async calls for the unary 
> commands my client wants the server to handle.
>
> So, it seems to be working nicely, except when the server writes 2 
> messages at the same time. Whether an actual write call using my stored 
> ServerWriter, or an indirect write when I return a status in a unary 
> handler.
> In such a case, the client always crashes in RunInterceptor.
>
> So my questions are:
>
>    - is it even possible to have the server (and the client) handle 
>    multiple rpc from the same client in parallel, including a streaming call?
>    - if yes, how to properly achieve this?
>
>
> Thanks for your insight,
> Chris
>

-- 
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/b227e5fa-e74b-4315-b408-9c9a663a9f16n%40googlegroups.com.

Reply via email to