Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sjrpc
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
sjrpc
Commits
9151bf7f
Commit
9151bf7f
authored
13 years ago
by
Antoine Millet
Browse files
Options
Downloads
Patches
Plain Diff
Enhanced fundamentals documentation
parent
37501d9a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/fundamentals.rst
+10
-4
10 additions, 4 deletions
doc/fundamentals.rst
with
10 additions
and
4 deletions
doc/fundamentals.rst
+
10
−
4
View file @
9151bf7f
...
...
@@ -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
ed
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', 1337
n
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
------------------------
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment