Broadcasting support for MoaT applications
Project description
Broadcasting
% start synopsis
This module provides async broadcasting, with a finite, non-blocking message queue and data loss detection.
% end synopsis
Installation
pip install moat-lib-broadcast
Usage
from moat.lib.broadcast import Broadcaster
import anyio
from contextlib import aclosing
async def reader(bc):
async with aclosing(bc) as mq:
async for msg in mq:
print(f"Received: {msg}")
async with anyio.create_task_group() as tg, Broadcaster() as bc:
# Start readers
tg.start_soon(reader, aiter(bc))
tg.start_soon(reader, bc.reader(10)) # explicit queue length
# Send messages
bc("Hello")
await anyio.sleep(0.01)
bc("World")
License
This project is part of the MoaT ecosystem and is licensed under the same terms.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file moat_lib_broadcast-0.1.1.tar.gz.
File metadata
- Download URL: moat_lib_broadcast-0.1.1.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
395a559b06c95b3196bea92c387d9811a33fce0701fbd14cf8c506c41282b508
|
|
| MD5 |
f7353830c127ac282f5fb3e80d6d4681
|
|
| BLAKE2b-256 |
f71bbecbe034223b3323ef54dc2e8559b43e2972739ea4b58f807341571952f0
|
File details
Details for the file moat_lib_broadcast-0.1.1-py3-none-any.whl.
File metadata
- Download URL: moat_lib_broadcast-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c38e5d014aa3acf9de3e2f3e4b18e161195ef643a467700ba464e2a36d1398ea
|
|
| MD5 |
9f76a9c91ca77a77c0e307d54ad400eb
|
|
| BLAKE2b-256 |
91e59694b27b647949e87dd254124906f12cae5a2c4856e89b1006829236726c
|