-
Notifications
You must be signed in to change notification settings - Fork 7
/
README
50 lines (34 loc) · 1.35 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
===========================================================================
This project is deprecated. You might try any future nng Python bindings or
simply use PyZMQ since version 0.17 gets rid of custom event loop.
===========================================================================
Aionn is Python asyncio messaging library based on `nanomsg` and `nnpy`.
Features
- simple API consistent with `nnpy` Python library
- no custom event loop
The `aionn` API follows API of the `nnpy` Python library. The only
difference is that the `aionn.Socket.recv` and `aionn.Socket.send` methods
are coroutines.
Example of pull socket::
import asyncio
import aionn
socket = aionn.Socket(aionn.AF_SP, aionn.PULL)
socket.bind('tcp://*:5555')
loop = asyncio.get_event_loop()
value = loop.run_until_complete(socket.recv())
print(value)
Example of push socket::
import asyncio
import aionn
socket = aionn.Socket(aionn.AF_SP, aionn.PUSH)
socket.connect('tcp://localhost:5555')
loop = asyncio.get_event_loop()
loop.run_until_complete(socket.send('some data'))
See also `examples` directory.
Requirements
- `nnpy` ver. 1.3
- `nanomsg` ver. 1.0
- Python ver. 3.5
The `aionn` library is licensed under terms of GPL license, version 3, see
`COPYING <http://git.savannah.gnu.org/cgit/decotengu.git/plain/COPYING>`_
file for details.