The scenario you have described is more suited to Pub/Sub implementation. 
Maybe you can consider building your solution around a message broker, 
wherein the updates of data change(whenever happens) is published on the 
message queue and the client can read the updates as and when it comes. But 
if for some reason, you want to do the same in gRPC, you can have async 
streaming based RPC to ship out changes. But you need to be careful of the 
pitfalls of long running RPCs for e.g. for channel management gRPC may 
decide to end a connection due to various reasons. Also, your client 
application won't be notified of the broken connection until it actually 
uses the channel to send something   which I doubt your application would 
be doing as it would be waiting to consume change messages only

On Monday, May 11, 2020 at 8:33:41 PM UTC+5:30, [email protected] wrote:
>
>
> Hi
>
> I have a special requirement for my application that I need to notify my 
> client application from some changes in server side. I'm using gRPC for 
> transferring my data from server to client and I was thinking for a 
> workaround for my problem.
> I thought maybe I could postpone sending my gRPC response to when my data 
> is ready. So my application could simulate a semi event-based with 
> following pseudo-code:
>
>    1. Client calls *getData()* rpc call.
>    2. Server checks if any data is available. if data is available go to 
>    4.
>    3. Wait for data to become available.
>    4. Send data to client.
>    5. Client process received data and goes to step 1.
>    6. If connection is broken, Client goes to step 1.
>    
> In this way, whenever any data is ready on server, it will be sent to 
> client. But I wonder if this approach is correct and feasible? Assuming 
> that data may be ready after hours we may keep a connection open between 
> client and server. Is there any better way to do what I need?
>
> Best regards
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/80b9e747-ae33-4bc7-b3d1-cfb952cc9f53%40googlegroups.com.

Reply via email to