Skip to main content

asyncio-friendly Python wrapper for libdatachannel (WebRTC Data Channels)

Project description

aiolibdatachannel

An asyncio-friendly Python wrapper around libdatachannel — a lightweight C/C++ WebRTC stack. aiolibdatachannel exposes WebRTC Peer Connections and Data Channels through idiomatic async/await Python.

Scope: PeerConnection + DataChannel only. WebSocket and Media/RTP transport are deliberately disabled in this build to keep the wheel small and the API focused.

Install

pip install aiolibdatachannel

Wheels are published for Linux (manylinux_2_28 x86_64 / aarch64) and macOS (arm64, 14.0+). Intel Macs and Windows aren't currently covered — Intel Mac because Apple Silicon is the modern target, Windows because libdatachannel dynamically links OpenSSL and the wheel packaging for that on Windows is still open. libdatachannel is bundled as a shared library inside the wheel and loaded via cffi — no native Python extension, no per-Python-version build, one py3-none-<platform> wheel covers every supported interpreter.

Quickstart

import asyncio
from aiolibdatachannel import PeerConnection, RTCConfiguration

async def main() -> None:
    config = RTCConfiguration(ice_servers=["stun:stun.l.google.com:19302"])

    async with PeerConnection(config) as pc:
        dc = await pc.create_data_channel("chat")

        offer = await pc.create_offer()
        # ... ship `offer` to the peer via your signalling channel ...
        answer_sdp = await receive_answer_from_peer()
        await pc.set_remote_description(answer_sdp, "answer")

        await dc.wait_open()
        await dc.send(b"hello")

        async for message in dc:
            print("got", message)

asyncio.run(main())

See examples/offerer.py and examples/answerer.py for a runnable pair of scripts that negotiate over stdin/stdout.

Logging

Route libdatachannel's internal logs through Python's standard logging module:

import logging
from aiolibdatachannel import install_python_logger

logging.basicConfig(level=logging.INFO)
install_python_logger()  # logger name defaults to "aiolibdatachannel"

Severities are translated (FATAL→CRITICAL, ERROR→ERROR, WARNING→WARNING, INFO→INFO, DEBUG/VERBOSE→DEBUG) and the filter threshold on the native side is derived from the Python logger's effective level, so you don't pay to format lines that would be filtered out anyway. Pass install_python_logger(my_logger) or install_python_logger(level=LogLevel.DEBUG) to customise.

Development

git clone --recursive https://github.com/social-home-io/aiolibdatachannel.git
cd aiolibdatachannel
pip install -e .[dev]
pytest

See docs/BUILDING.md for detailed build instructions, including how to switch TLS backends and how to bump the bundled libdatachannel version.

License

This project is licensed under the Mozilla Public License 2.0, matching the license of libdatachannel which it bundles and statically links. See LICENSE and vendor/libdatachannel/LICENSE.

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

aiolibdatachannel-2026.4.22.2.tar.gz (11.7 MB view details)

Uploaded Source

Built Distributions

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

aiolibdatachannel-2026.4.22.2-cp312-abi3-manylinux_2_28_x86_64.whl (4.0 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ x86-64

aiolibdatachannel-2026.4.22.2-cp312-abi3-manylinux_2_28_aarch64.whl (3.9 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ ARM64

aiolibdatachannel-2026.4.22.2-cp312-abi3-macosx_14_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.12+macOS 14.0+ ARM64

File details

Details for the file aiolibdatachannel-2026.4.22.2.tar.gz.

File metadata

  • Download URL: aiolibdatachannel-2026.4.22.2.tar.gz
  • Upload date:
  • Size: 11.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aiolibdatachannel-2026.4.22.2.tar.gz
Algorithm Hash digest
SHA256 da6809f994e1318ce69569e8fc7a936f3d906ae8c340ef870380afaacba28f05
MD5 e780128abfc4092cf64eb059cb144b92
BLAKE2b-256 47ce606aa32462f446324b475a7f73f0138f4329e10695f3c0ad1b5e70de7e68

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolibdatachannel-2026.4.22.2.tar.gz:

Publisher: release.yml on social-home-io/aiolibdatachannel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aiolibdatachannel-2026.4.22.2-cp312-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for aiolibdatachannel-2026.4.22.2-cp312-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 31ea69abe1561f1bbcff87922090dc7b86e1b0d69717b8de0ce02096851f219e
MD5 39a08059a003f1b61b0a47e74f57aff8
BLAKE2b-256 303da808dde11dcb369ab1265e33c2f9d420d1f98266fc0cac9bae8cab60d993

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolibdatachannel-2026.4.22.2-cp312-abi3-manylinux_2_28_x86_64.whl:

Publisher: release.yml on social-home-io/aiolibdatachannel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aiolibdatachannel-2026.4.22.2-cp312-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for aiolibdatachannel-2026.4.22.2-cp312-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6f39742cbcf8bc670733b338cc2a182f2649688a78da5d7aab947e02445307c7
MD5 3b0795b66f094b11697832a5e9a521bf
BLAKE2b-256 a5f5a0dad5cbb18cc0be83a4162ba2bd4929107ec301b6180c999225af171a81

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolibdatachannel-2026.4.22.2-cp312-abi3-manylinux_2_28_aarch64.whl:

Publisher: release.yml on social-home-io/aiolibdatachannel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aiolibdatachannel-2026.4.22.2-cp312-abi3-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for aiolibdatachannel-2026.4.22.2-cp312-abi3-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 4df4409a85e45c4343983823365edf249abfd2f55e62ea8984a025bd16cc4f7c
MD5 49e30febcc4bcca4fdfb435a3e99b320
BLAKE2b-256 12bc3e378587dfced432a96e8ca174cbad2030fb451f08657f92b5c23791526e

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolibdatachannel-2026.4.22.2-cp312-abi3-macosx_14_0_arm64.whl:

Publisher: release.yml on social-home-io/aiolibdatachannel

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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