pseud a bidirectionnal RPC library ready for the hostile web¶
Initialize an RPC peer playing as a server
# The server
from pseud import Server
server = Server('service')
server.bind('tcp://127.0.0.1:5555')
@server.register_rpc
def hello(name):
return 'Hello {0}'.format(name)
await server.start() # this would block within its own io_loop
Prepare a client
from pseud import Client
client = Client('service')
client.connect('tcp://127.0.0.1:5555')
then make a remote procedure call (rpc)
# Assume we are inside a coroutine
async with client:
response = await client.hello('Charly')
assert response == 'Hello Charly'