Namspacing

PEP 20

PEP 20

Namespaces are one honking great idea -- let's do more of those!

Tip

An EasyRpcServer can register functions in multiple namespaces, if unspecified 'Default' is used.

easy_server = await EasyRpcServer.create(
    server, 
    '/ws/easy', 
    server_secret='abcd1234'
)

Registration

Tip

Registration can be performed using the @decorator syntax or via easy_server.orgin(f, namespace='Namespace')

Decorator

@easy_server.orgin # default
def foo(x):
    return x
@easy_server.orgin(namespace='Public')
def bar(x):
    return x

Register progamatically

def foo(x):
    return x
easy_server.orgin(foo, namespace='private')