资 源 简 介
jpc is a fast Python JSON RPC package, partially compliant with JSON-RPC version 1 (http://json-rpc.org/wiki/specification).
Serve a method:
```
import jpc
class MyHandler(jpc.BaseHandler):
def echo(self, str):
return str
jpc.start_server(host="localhost", port=50000, handler=MyHandler)
```
Call a method on server:
c = jpc.connect(host="localhost", port=50000)jpc.Proxy(c).echo("Hello, world!")
The host and port parameters of start_server() and connect() are optional.
To send JSON RPC notifications replace the Proxy class with the Notifier class. Notifications are "asynchronous" and an order of magnitude faster than calls.
Benchmarks off a 2.4GHz Core 2 Duo laptop:
* Create-call-close 4000 connections per second per process.
* Up to 13,000 calls per second per process.
* Up to 40,000 notifications per second per process.
Notes:
* T