diff --git a/doc/fundamentals.rst b/doc/fundamentals.rst index 2be1e3f549cd82cbd885725d732c53631c8c364a..abea10bd7520668fb6dff9aebb316298a4a4121e 100644 --- a/doc/fundamentals.rst +++ b/doc/fundamentals.rst @@ -82,6 +82,7 @@ can disable this behavior with the `disable_fallback` parameter of the a special rpc message "capabilities" is received. .. note:: + When the fallback mode is enabled, you can't use another protocols than the default rpc. All calls to :meth:`RpcConnection.register_protocol`, :meth:`RpcConnection.unregister_protocol`, :meth:`RpcConnection.create_rpc` diff --git a/sjrpc/core/async.py b/sjrpc/core/async.py index 05589bba89cb23df0487ade210e0547c0d8a6128..56e945dbc8cc9e0730f305a48a412e9f5d32d678 100644 --- a/sjrpc/core/async.py +++ b/sjrpc/core/async.py @@ -9,11 +9,13 @@ class AsyncWatcher(object): ''' Asynchronous call watcher -- Handle asynchronous calls and responses. - Usage example: - >>> watcher = AsyncWatcher() - >>> watcher.register(conn1, 'ping') - >>> watcher.register(conn2, 'ping') - >>> responses = watcher.wait() # Wait for all responses + Usage example:: + + >>> watcher = AsyncWatcher() + >>> watcher.register(conn1, 'ping') + >>> watcher.register(conn2, 'ping') + >>> responses = watcher.wait() # Wait for all responses + ''' def __init__(self): @@ -64,14 +66,15 @@ class AsyncWatcher(object): :return: received messages in a list .. note:: + You can repeat call to this method on a single :class:`AsyncWatcher`. For example, if you want to process the - first arrived message, then wait others for a minute, you can do: + first arrived message, then wait others for a minute, you can do:: - >>> msgs = watcher.wait(max_wait=1) - >>> process_speedy(msgs[0]) - >>> for msg in watcher.wait(timeout=60): - >>> process(msg) + >>> msgs = watcher.wait(max_wait=1) + >>> process_speedy(msgs[0]) + >>> for msg in watcher.wait(timeout=60): + >>> process(msg) ''' responses = [] while self.remains: