Commit 3fc403ef authored by Antoine Millet's avatar Antoine Millet

Documentation enhancements.

parent a945b027
......@@ -15,6 +15,7 @@ Features
be used without Gevent or Threading.
* **Multiplexed:** sjRpc can run many "protocols" on the same connection,
read more about protocols in `Multiplexing & protocols`_ section.
* **Fallback mode:** for compatibility with olders sjRpc.
Multiplexing & protocols
......@@ -35,11 +36,26 @@ For the moment, two types of protocols are implemented:
* **Tunnel:** protocol which allow to tunnel a socket through the sjRpc
connection.
.. note::
A Rpc protocol is automatically created and binded to label 0 when a
:class:`RpcConnection` class is instantiated. This can't be changed or
removed.
To register new protocols, you can use the :meth:`register_protocol` on
:class:`RpcConnection` instances, like this::
>>> from sjrpc.core.protocols import RpcProtocol, TunnelProtocol
>>> my_tunnel = myconn.register_protocol(1, TunnelProtocol)
do the same on other side, then
>>> mytunnel.send('ehlo !!')
>>> anwser = mytunnel.recv()
You can also use shortcuts::
>>> my_tunnel = myconn.create_tunnel(label=12)
or
>>> my_tunnel = myconn.create_tunnel() # Bind to the first free label
The same shortcut is available for rpc with :meth:`create_rpc`.
Default rpc, aka Rpc0
---------------------
......
......@@ -34,7 +34,7 @@ def pure(func):
Function handler decorator -- the function is a pure fonction, caller will
not pass :class:`RpcConnection` object as first call parameters.
.. note::
.. deprecated:: 14
This decorator is useless since the default behavior have change. You
can use :func:`pass_connection` decorator to do the opposite.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment