Skip to content
Snippets Groups Projects
Commit 3fc403ef authored by Antoine Millet's avatar Antoine Millet
Browse files

Documentation enhancements.

parent a945b027
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,7 @@ Features ...@@ -15,6 +15,7 @@ Features
be used without Gevent or Threading. be used without Gevent or Threading.
* **Multiplexed:** sjRpc can run many "protocols" on the same connection, * **Multiplexed:** sjRpc can run many "protocols" on the same connection,
read more about protocols in `Multiplexing & protocols`_ section. read more about protocols in `Multiplexing & protocols`_ section.
* **Fallback mode:** for compatibility with olders sjRpc.
Multiplexing & protocols Multiplexing & protocols
...@@ -35,11 +36,26 @@ For the moment, two types of protocols are implemented: ...@@ -35,11 +36,26 @@ For the moment, two types of protocols are implemented:
* **Tunnel:** protocol which allow to tunnel a socket through the sjRpc * **Tunnel:** protocol which allow to tunnel a socket through the sjRpc
connection. connection.
.. note:: To register new protocols, you can use the :meth:`register_protocol` on
A Rpc protocol is automatically created and binded to label 0 when a :class:`RpcConnection` instances, like this::
:class:`RpcConnection` class is instantiated. This can't be changed or
removed. >>> 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 Default rpc, aka Rpc0
--------------------- ---------------------
......
...@@ -34,7 +34,7 @@ def pure(func): ...@@ -34,7 +34,7 @@ def pure(func):
Function handler decorator -- the function is a pure fonction, caller will Function handler decorator -- the function is a pure fonction, caller will
not pass :class:`RpcConnection` object as first call parameters. not pass :class:`RpcConnection` object as first call parameters.
.. note:: .. deprecated:: 14
This decorator is useless since the default behavior have change. You This decorator is useless since the default behavior have change. You
can use :func:`pass_connection` decorator to do the opposite. can use :func:`pass_connection` decorator to do the opposite.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment