Unsolicited events

20 views
Skip to first unread message

Jeivardan

unread,
Nov 11, 2020, 9:57:10 PM11/11/20
to grp...@googlegroups.com
Hi All,

I have a use case where server send unsolicited events to clients to client’s. Is it possible with grpc, if so please tell how to do.

Thanks,
Jeivardan

Mya Pitzeruse

unread,
Nov 13, 2020, 10:16:17 AM11/13/20
to Jeivardan, grp...@googlegroups.com
I think this depends on what you mean by "unsolicited"... 

You could do this with a long-lived server or bi-directional streaming API. Clients can initiate the call and wait for messages. Then, servers will can send messages to the client when they need to. I'm not sure what language you're using, but there are many systems that leverage a "watch" pattern so finding a language specific example _shouldn't_ be too hard. Here's a golang sample where I implemented paxos using gRPC. Learners in the protocol watch acceptors over a server streaming API.

- proto definition: https://github.com/mjpitz/paxos/blob/main/api/paxos.proto#L37
- server: https://github.com/mjpitz/paxos/blob/main/internal/server/acceptor.go#L100-L135

--
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+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/CADh7ZcQ_YehfpocE4w%3DSTJDU7u%2BUgdu7KN-DOH-OBfUO0EA60w%40mail.gmail.com.


--
Mya Pitzeruse
Gender Pronouns: She, Her, Hers

Jeivardan

unread,
Nov 13, 2020, 9:33:44 PM11/13/20
to Mya Pitzeruse, grp...@googlegroups.com
Awesome, thanks!
Reply all
Reply to author
Forward
0 new messages