Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asynchronous Bidirectional RPC

Tags:

python

rpc

I am looking for a RPC library in Java or Python (Python is preferred) that uses TCP. It should support:

  • Asynchronous
  • Bidirectional
  • RPC
  • Some sort of event loop (with callbacks or similar)

Any recommendations? I have looked a things like bjsonrpc which seemed to be the right sort of thing however it didn't seem possible for the server to identify which connections; so if a user has identified himself/herself and a request comes in from another user to send a message to that user it doesn't expose that users connection so we can send the message.

like image 376
Yacoby Avatar asked Sep 03 '11 12:09

Yacoby


People also ask

Can gRPC be asynchronous?

The gRPC programming API in most languages comes in both synchronous and asynchronous flavors. You can find out more in each language's tutorial and reference documentation (complete reference docs are coming soon).

What is difference between gRPC and RPC?

gRPC is a framework that uses RPC to communicate. RPC is not Protobuf but instead Protobuf can use RPC and gRPC is actually Protobuf over RPC. You don't need to use Protobuf to create RPC services within your app. This is a good idea if you are doing libraries/apps from small to medium size.

Is gRPC bidirectional?

A gRPC call comprises of a bidirectional stream of messages, initiated by the client. In the client-to-server direction, this stream begins with a mandatory Call Header , followed by optional Initial-Metadata , followed by zero or more Payload Messages .

Are gRPC calls synchronous?

Additionally, a gRPC RPC can be synchronous or asynchronous. Synchronous: a client call waits for the server to respond. Asynchronous: client makes non-blocking calls to the server, and the server returns the response asynchronously.


1 Answers

You should definitely check out Twisted. It's an event-based Python networking framework that has an implementation of an event loop (called the "reactor") supporting select, poll, epoll, kqueue and I/O completion ports, and mediates asynchronous calls with objects called Deferreds

As for your RPC requirement, perhaps you should check out Twisted's PB library or AMP.

like image 137
rlotun Avatar answered Sep 28 '22 06:09

rlotun