Commit 8c77fe39 authored by Antoine Millet's avatar Antoine Millet

Updated documentation.

parent 4ed6bd8a
.. automodule:: sjrpc.core.protocols
......@@ -6,7 +6,7 @@ sjRpc API
.. toctree::
:maxdepth: 2
:maxdepth: 3
......@@ -8,7 +8,7 @@ in other projects.
* **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
......@@ -13,6 +13,13 @@ This packages export following function/classes:
* :class:`AsyncWatcher` which allow to make asynchronous calls.
It also contains a sub-package containing protocols: :mod:`core.protocols`.
.. toctree::
from sjrpc.core.rpcconnection import *
......@@ -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::
Also, the connection object expose :meth:`call` and :meth:`async_call`
method from default rpc, so you can use it directly on connection::
>>>'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.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment