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

Enhanced fundamentals documentation

parent 37501d9a
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@ in other projects.
Features
--------
* **Bidirectional:** remote function can be call by both side of the
* **Bidirectional:** remote function can be called by both side of the
connection, so a client can connect to a server and export functions to it.
* **Fully event based**: sjRpc takes profits of asynchronous io, allowing a
server to handle thousands of client connection with a reasonable memory
......@@ -26,7 +26,7 @@ Server side, create the handler
The handler is a simple object with a dict interface (getitem) responsible of
the association between the remote-function name and the locally executed
callable. The :class:`sjrpc.utils.Handler` class allow you to define
callable. The :class:`sjrpc.utils.Handler` class help you to define
an handle with a simple class extending this one::
>>> class MyHandler(RpcHandler):
......@@ -46,7 +46,7 @@ Server side, create the :class:`~sjrpc.core.RpcServer` instance
The last thing to do on the server side is to launch the server itself::
>>> from sjrpc.server import RpcServer
>>> serv = RpcServer.from_addr('127.0.0.1', 1337n conn_kw=dict(handler=handler))
>>> serv = RpcServer.from_addr('127.0.0.1', 1337, conn_kw=dict(handler=handler))
>>> serv.run()
.. note::
......@@ -59,9 +59,12 @@ Client side, just connect !
^^^^^^^^^^^^^^^^^^^^^^^^^^^
For a basic client usage, the only thing you have to do is to create the
:class:`RpcConnection` instance to the server, nothing more simple::
:class:`~sjrpc.core.RpcConnection` instance to the server and start the
:class:`~sjrpc.core.RpcConnection` main-loop in another thread to keep the
hands on your term::
>>> conn = RpcConnection.from_addr('127.0.0.1', 1337)
>>> threading.Thread(target=conn.run).start()
>>> print conn.call('random')
42
......@@ -72,6 +75,9 @@ You can also use a proxy to simplify remote calls::
>>> print proxy.random(min=42, max=1000)
587
Proxy will also restore built-in exceptions embedded in
:class:`~sjrpc.core.RpcError`.
Multiplexing & protocols
------------------------
......
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