Commits

William Pitcock committed 79462be

Update README more.

  • Participants
  • Parent commits bc5e7e4

Comments (0)

Files changed (1)

 This is the RPC definition for Edia and some code for it.  It is meant to be used as a git submodule,
 and is shared by a few tortoiselabs products for RPC calling.
 
+## Using this as a Client
+
+Using this as a Client is simple enough, usually.  Here is a sample interactive python session:
+
+```
+>>> from ediarpc import rpc_client
+>>> cli = rpc_client.ServerProxy('localhost', 5959, 'moocows')
+>>> cli.ping()
+{u'hello': {}}
+>>> cli.ping(hello='world')
+{u'hello': {u'hello': u'world'}}
+>>> cli.ping(key='value', key2=['list', 'of', 'values'], key3=True, key4=25.3)
+{u'hello': {u'key3': True, u'key2': [u'list', u'of', u'values'], u'key': u'value', u'key4': 25.3}}
+```
+
+This is from a server which has a single method `ping(...)` which simply returns back the `kwargs`
+list.
+
+## Using this as a Server
+
+Simply `bind()` any function which takes a `kwargs` list and then run the server:
+
+```
+>>> from ediarpc import rpc_server
+>>> def ping(**kwargs):
+...     return dict(hello=kwargs)
+...
+>>> server = rpc_server.RPCServer(('127.0.0.1', 5959), 'moocows')
+>>> server.bind(ping)
+>>> server.serve_forever()
+```
+
 ## Call syntax
 
 ```