Skip to main content

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.asyncio.protocol.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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiomoqt-0.3.2.tar.gz (38.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiomoqt-0.3.2-py3-none-any.whl (44.1 kB view details)

Uploaded Python 3

File details

Details for the file aiomoqt-0.3.2.tar.gz.

File metadata

  • Download URL: aiomoqt-0.3.2.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

Hashes for aiomoqt-0.3.2.tar.gz
Algorithm Hash digest
SHA256 4ada9623ef60fdccbab695549fc788ee5b71667ce49cd7e9784dcd4871f0ad8f
MD5 61ac28d4815479bed1c68d63ebf357c2
BLAKE2b-256 a4e6cd9ef4ec31efc8c474efce2ec5b449d037bca3700e3fa09aa1766a798cc8

See more details on using hashes here.

File details

Details for the file aiomoqt-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: aiomoqt-0.3.2-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

Hashes for aiomoqt-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 57334e669cf41bb2bee79bafeeeb9484e799663da447c7b3a767cc833946aa24
MD5 8f7784e4ca87d5cd754b160cd8b82bf4
BLAKE2b-256 89770c6024c36676f0c2ed486d6564bb91a5189f605b7479453e129b35bc587c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page