Loading doc/api/core.protocols.rst 0 → 100644 +7 −0 Original line number Diff line number Diff line Protocols --------- .. automodule:: sjrpc.core.protocols :members: :inherited-members: doc/api/index.rst +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ sjRpc API Sub-packages: .. toctree:: :maxdepth: 2 :maxdepth: 3 core server Loading doc/fundamentals.rst +1 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ in other projects. Features -------- * **Bidirectional:** remote function can be call by both side of the, * **Bidirectional:** remote function can be call by both side of the connection, so a client can connect to a server and export functions to it. * **Use Gevent:** the server mode can use Gevent to take profits of asynchronous io, but a threaded mode is also provided. The client mode can Loading sjrpc/core/__init__.py +7 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,13 @@ This packages export following function/classes: exceptions. * :class:`AsyncWatcher` which allow to make asynchronous calls. It also contains a sub-package containing protocols: :mod:`core.protocols`. .. toctree:: :hidden: api/core.protocols ''' from sjrpc.core.rpcconnection import * Loading sjrpc/core/rpcconnection.py +26 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,32 @@ class RpcConnection(object): ''' This class manage a single peer connection. You can wrap an existing socket with the default constructor:: >>> conn = RpcConnection(mysocket) Or create a new socket automatically with from_addr constructor:: >>> conn = RpcConnection.from_addr(host, port) If you prefer SSL connection, you can use the from_addr_ssl constructor:: >>> conn = RpcConnection.from_addr_ssl(host, port) By default, an :class:`RpcProtocol` is created on label 0, you can access to this rpc through the `conn.rpc` shortcut:: >>> conn.rpc.call('ping') Also, the connection object expose :meth:`call` and :meth:`async_call` method from default rpc, so you can use it directly on connection:: >>> conn.call('ping') # Equivalent to the exemple before .. seealso:: You can read the :ref:`Default rpc, aka Rpc0` section to know more about the default rpc :param sock: the socket object of this newly created :class:`RpcConnection` :param \*args,\*\*kwargs: arguments to pass to the default rpc protocol automatically registered on label 0. Loading Loading
doc/api/core.protocols.rst 0 → 100644 +7 −0 Original line number Diff line number Diff line Protocols --------- .. automodule:: sjrpc.core.protocols :members: :inherited-members:
doc/api/index.rst +1 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ sjRpc API Sub-packages: .. toctree:: :maxdepth: 2 :maxdepth: 3 core server Loading
doc/fundamentals.rst +1 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ in other projects. Features -------- * **Bidirectional:** remote function can be call by both side of the, * **Bidirectional:** remote function can be call by both side of the connection, so a client can connect to a server and export functions to it. * **Use Gevent:** the server mode can use Gevent to take profits of asynchronous io, but a threaded mode is also provided. The client mode can Loading
sjrpc/core/__init__.py +7 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,13 @@ This packages export following function/classes: exceptions. * :class:`AsyncWatcher` which allow to make asynchronous calls. It also contains a sub-package containing protocols: :mod:`core.protocols`. .. toctree:: :hidden: api/core.protocols ''' from sjrpc.core.rpcconnection import * Loading
sjrpc/core/rpcconnection.py +26 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,32 @@ class RpcConnection(object): ''' This class manage a single peer connection. You can wrap an existing socket with the default constructor:: >>> conn = RpcConnection(mysocket) Or create a new socket automatically with from_addr constructor:: >>> conn = RpcConnection.from_addr(host, port) If you prefer SSL connection, you can use the from_addr_ssl constructor:: >>> conn = RpcConnection.from_addr_ssl(host, port) By default, an :class:`RpcProtocol` is created on label 0, you can access to this rpc through the `conn.rpc` shortcut:: >>> conn.rpc.call('ping') Also, the connection object expose :meth:`call` and :meth:`async_call` method from default rpc, so you can use it directly on connection:: >>> conn.call('ping') # Equivalent to the exemple before .. seealso:: You can read the :ref:`Default rpc, aka Rpc0` section to know more about the default rpc :param sock: the socket object of this newly created :class:`RpcConnection` :param \*args,\*\*kwargs: arguments to pass to the default rpc protocol automatically registered on label 0. Loading