Python asyncio implementation of the MoQT protocol
Project description
aiomoqt - Media over QUIC Transport (MoQT)
aiomoqt is an implementaion of the MoQT protocol, based on asyncio and aioquic.
Overview
This package implements the MoQT Specification (currently draft-10). It is desinged for general use as an MoQT client and server library, supporting both 'publish' and 'subscribe' roles.
The architecture follows the asyncio.Protocol design pattern, and extends the aioquic QuicConnectionProtocol protocol.
Featurtes
- Provides 'Async Context Manager' support for session connection management.
- Supports asynchronous and awaitable synchronous calls via an optional flag.
- High-level API for control messages with default and custom response handlers.
- Low-level API for control and data message serialization and deserialization.
🚀 Status: Alpha
Installation
Install using pip:
pip install aiomoqt
Or using uv:
uv pip install aiomoqt
Usage
Basic Client Example
import asyncio
from aiomoqt.client import MOQTClientSession
client = MOQTClientSession(host=127.0.0.1, port=443, endpoint='wt-endpoint')
async with client.connect() as session:
try:
await session.client_session_init():
response = await session.subscribe(
'namespace',
'track_name',
wait_response=True
)
# wait for session close, process data and control messages
await session.async_closed()
except MOQTException as e:
session.close(e.error_code, e.reason_phrase)
asyncio.run(main())
The high-level control message API is used for sending MoQT control messages to a server, providing typical default values for most arguments, and flexible type handling for input arguments. Those messages which expect a response, support the blocking asyncio await call construct via an optional flag (wait_response=True). The synchronous call will return a response message object. Asynchronous calls will return the request message object, and will return immediately. Some response handling is provided by the default handler.
The message serialization/deserialization classes provide <moqt-msg-obj>.serialize() which returns an 'aioquic' Buffer with the entire message serialized in buf.data and buf.tell() at the end of the buffer. The buffer data may be passed directly to session.send_control_message(). The <moqt-msg-class>.deserialize() call returns an instance of the given class populated from the deserialized data. MoQT messages that start with a type and length, will already have had the type and length parsed/pulled provided 'aioquic' buffer.
see aiomoqt-python/aiomoqt/examples for additional examples
Development
To set up a development environment:
git clone https://github.com/gmarzot/aiomoqt-python.git
cd aiomoqt-python
./bootstrap_python.sh
source .venv/bin/activate
Installation
uv pip install .
TODO
- Direct QUIC connection
- Flesh out more message sending and handling API's
- Support for completion call back to replace or augment default handling
- Move track data read/write API to aiomoqt.messages.track
- Support file I/O MOQT File Format
- Simple relay (?)
- More tests
Contributing
Contributions are welcome! If you'd like to contribute, please:
- Fork the repository on GitHub.
- Create a new branch for your feature or bug fix.
- Submit a pull request with a clear description of your changes.
For major changes, please open an issue first to discuss your proposal.
Resources
Acknowledgements
This project takes inspiration from, and has benefited from the great work done by the Meta/moxygen team, and the continued efforts of the MOQ IETF WG.
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
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 aiomoqt-0.3.7.tar.gz.
File metadata
- Download URL: aiomoqt-0.3.7.tar.gz
- Upload date:
- Size: 38.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0221777fc9de8fc2e2dd8f201286ee1f506e9ac057315072c19349c8980adfe3
|
|
| MD5 |
75d5915f37cbce19bed07b81606223bf
|
|
| BLAKE2b-256 |
1a6e2f0104c96d8cf396ee6c50b4ce35be257bc393a2be1d7e902dfc44332fcf
|
File details
Details for the file aiomoqt-0.3.7-py3-none-any.whl.
File metadata
- Download URL: aiomoqt-0.3.7-py3-none-any.whl
- Upload date:
- Size: 44.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ffd1b1e6eea8ebd8c18a904bf96c1547cfb024d26a911bb8b5b0ed96445a6818
|
|
| MD5 |
270cabb952fbd2c0c31f0ee31eb20279
|
|
| BLAKE2b-256 |
da88116766ba81a17239a0b3b7145a800a67d4866c13773205b4995c47585ea7
|