Pubsub system for aio framework
Project description
Pubsub system for the aio asyncio framework
Build status
Installation
Install with:
pip install aio.signals
Code example
The callback listener takes 2 arguments, the name of the signal, and the argument that was emitted
The listen function is called synchronously, but the callback listener should be a coroutine or future
The emit function is a coroutine
import asyncio
from aio.signals import Signals
@asyncio.coroutine
def listener(signal, message):
print(message)
signals = Signals()
signals.listen("my-signal", listener)
loop = asyncio.get_event_loop()
loop.run_until_complete(
signals.emit("my-signal", 'BOOM!'))
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aio.signals-0.0.2.tar.gz
(2.9 kB
view details)
File details
Details for the file aio.signals-0.0.2.tar.gz
.
File metadata
- Download URL: aio.signals-0.0.2.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 886c4d922084d40e1e9135acd77b1c0299381a5e3bab262a75d546a5e2c87f5d |
|
MD5 | 4fbbcde4d2d9ba46372589062a16513d |
|
BLAKE2b-256 | c91d96f43ad97cd950455443d0d9f4d483ff26645e17cd579947e447e13bead8 |