a lightweight, high performance, multilingual RPC library
Have a look at Spec and write your own client in minutes!
We follow a very simple and efficient protocol as follows for greatly reducing your effort to build up your high performance architecture. Therefore if there has not been an client library off the shelf, you can easily pick up a BSON library and write your own. And here are available BSON libraries in many programming languages for your use.
pip install bson-rpc
or,
pip install git+https://github.com/hmisty/bson-rpc.git
server.py
from bson_rpc import rpc, start_server
@rpc
def add(a, b):
return a + b
def main(host, port):
start_server(host, port)
if __name__ == '__main__':
host = '127.0.0.1'
port = 8181
main(host, port)
client.py
from bson_rpc.client import connect
if __name__ == '__main__':
host = '127.0.0.1'
port = 8181
conn = connect(host, port)
print('connected to server %s' % host)
conn.use_service(['add']);
err, res = conn.add(1,2)
print('result: %s' % str(res))
conn.disconnect();
print('disconnected from server %s' % host)
nodejs: https://github.com/hmisty/bson-rpc-nodejs
Java: https://github.com/hmisty/bson-rpc/tree/master/examples/demo_java_raw
Go: https://github.com/hmisty/bson-rpc/tree/master/examples/demo_go_raw
Author: Evan Liu (hmisty).
Copyright (c) 2017 Evan Liu (hmisty). MIT License.