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)

server.start() # this would block within its own io_loop

Prepare a tornado-based client

# The tornado client
# Assume tornado IOLoop is running
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
response = yield client.hello('Charly')
assert response == 'Hello Charly'

A gevent api is also available for clients

# The gevent client
from pseud import Client


client = Client('service')
client.connect('tcp://127.0.0.1:5555')

assert client.hello('Charly').get() == 'Hello Charly'