-
Notifications
You must be signed in to change notification settings - Fork 19
Home
deavid edited this page Dec 24, 2010
·
17 revisions
BJSONRPC (Bi-directional JSON-RPC) is a JSON-RPC implementation aimed at speed, simplicity, elegance, and lots of features.
It's a good replacement to XML-RPC in environments where interactivity is critical.
- Implemented in pure python
- TCP/IP Socket based. There is no HTTP version.
- Connections are permanent and reused for multiple calls.
- Low bandwith use. (aprox 60 bytes or less per call)
- Minimal network latency. (with asyncronous calls is possible to use the full bandwith)
- Methods can be stateful (they can remember what you called before, etc)
- Allows (and simplifies) asynchronous calls.
- Event-driven client and server (can be run with no threads at all)
- Allows keyword arguments
- Bidirectional. Client can also publish methods for server.
- Object Oriented Programming (OOP). Objects can be created and handled remotely.
- Client/Server Object Reference. You can create a object in the other end and tell some method to use it.
- Server Method Reference. You can pass a server method as a parameter to a server function.
import bjsonrpc
class MyHandler(bjsonrpc.BaseHandler):
def add(self,a,b): return a+b
bjsonrpc.server(handler_factory=MyHandler).serve()
import bjsonrpc
conn = bjsonrpc.connect() # defaults to 127.0.0.1:10123
print conn.call.add(2,3) # prints 5