Protobuf RPC callbacks


Protobuf RPC callbacks



Is there any way to do the invoke call from server to the client with Protobuf RPC(while custom call from client to the server, not directly)?



I'm meaning, for example, describe service method in *.proto file with callback param?



Im using gRPC library.




1 Answer
1



The general way to do server->client messages in gRPC is through "streaming". That is, the client makes a call to the server, and then the server can "stream" back a series of messages to the client before eventually completing the call.



See: http://www.grpc.io/docs/guides/concepts.html#server-streaming-rpc



Of course, "streaming" is a pretty different pattern from a traditional "callback", but you can often solve the same problems with it.



Note that Cap'n Proto RPC -- an alternative to Protobuf and gRPC -- fully supports calls in both directions by virtue of supporting object references as a first-class type: a client can, for example, make a call to the server in which it provides an object reference to use for callbacks, and then the server can later on make calls back to that object on the client.



(Disclosure: I am the author of Google's Protobuf v2 and also the author of Cap'n Proto, but I am not affiliated with gRPC.)





thanks so much :)
– Alexandr Derkach
Feb 28 '16 at 13:45






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

How to input without newline? (Python)

C++ thread error: no type named ‘type’ MINGW

Analog for TagView in flutter