Skip to main content

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_34 x86_64 / aarch64) and macOS (arm64, 14.0+) per CPython version (cp312 / cp313 / cp314). 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.

ℹ️ Earlier releases shipped a single cp312-abi3 wheel covering all CPython 3.12+. The bundled OpenSSL inside that wheel collided with the OpenSSL CPython itself loads via _ssl / hashlib (process- global PRNG / FIPS state), which segfaulted on first PeerConnection use under CPython 3.14. We now publish per-version wheels so each binary lines up with the matching interpreter ABI.

The Python↔C boundary uses nanobind: libdatachannel and its static dependencies (usrsctp, libjuice, OpenSSL) link directly into the extension. The binding layer itself is deliberately thin: native trampolines route every libdatachannel callback through a single Python dispatcher, and the asyncio semantics live in the pure-Python wrapper on top, not in C++.

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

Full native build (requires a C++17 toolchain, CMake ≥ 3.24, ninja, and OpenSSL headers):

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

If you only need to touch the Python wrapper (async semantics, async iterators, event plumbing), skip the C++ build and run against the pure-Python stand-in from tests/_fake_native.py:

pip install pytest pytest-asyncio
PYTHONPATH=. pytest -m "not native"

tests/conftest.py injects the fake into sys.modules whenever AIOLIB_REQUIRE_NATIVE is unset. Tests marked @pytest.mark.native (loopback, cancellation, logging, errors, stress) are auto-skipped in that mode.

Long-running soak tests (10 000-message loopback, 100 PC lifecycles, shutdown-leak subprocess checks) live behind a stress marker and are off by default — enable with pytest -m stress or AIOLIB_STRESS=1 pytest. They also run nightly in CI.

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.

Release files for aiolibdatachannel 2026.9.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiolibdatachannel 2026.9.8
File Size Uploaded
aiolibdatachannel-2026.9.8.tar.gz 11.7 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for aiolibdatachannel 2026.9.8
File
aiolibdatachannel-2026.9.8-cp314-cp314-manylinux_2_34_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.34+ x86-64 Details
aiolibdatachannel-2026.9.8-cp314-cp314-manylinux_2_34_aarch64.whl CPython 3.14 CPython 3.14 Linux glibc 2.34+ ARM64 Details
aiolibdatachannel-2026.9.8-cp314-cp314-macosx_14_0_arm64.whl CPython 3.14 CPython 3.14 macOS 14.0+ ARM64 Details
aiolibdatachannel-2026.9.8-cp313-cp313-manylinux_2_34_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ x86-64 Details
aiolibdatachannel-2026.9.8-cp313-cp313-manylinux_2_34_aarch64.whl CPython 3.13 CPython 3.13 Linux glibc 2.34+ ARM64 Details
aiolibdatachannel-2026.9.8-cp313-cp313-macosx_14_0_arm64.whl CPython 3.13 CPython 3.13 macOS 14.0+ ARM64 Details
aiolibdatachannel-2026.9.8-cp312-cp312-manylinux_2_34_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ x86-64 Details
aiolibdatachannel-2026.9.8-cp312-cp312-manylinux_2_34_aarch64.whl CPython 3.12 CPython 3.12 Linux glibc 2.34+ ARM64 Details
aiolibdatachannel-2026.9.8-cp312-cp312-macosx_14_0_arm64.whl CPython 3.12 CPython 3.12 macOS 14.0+ ARM64 Details

Total release size: 55.3 MB

Release files / aiolibdatachannel-2026.9.8.tar.gz

Download URL aiolibdatachannel-2026.9.8.tar.gz
Size 11.7 MB
Tags Source
SHA-256 checksum
How to use checksums
32a1c50c62ddf3d5ebf9e167b150de3bb57d6cbe17c31b45eacf536b06cf3531
BLAKE2b-256 checksum
How to use checksums
70192b5f3844f4c0108beafa95f3199acc91f36d37b51148b52710bef520bb7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Release files / aiolibdatachannel-2026.9.8-cp314-cp314-manylinux_2_34_x86_64.whl

Download URL aiolibdatachannel-2026.9.8-cp314-cp314-manylinux_2_34_x86_64.whl
Size 5.2 MB
Tags CPython 3.14 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
e7550ed75353b56a5af5c7dc28d29196b416d4ffee67f5240d4a569913f52183
BLAKE2b-256 checksum
How to use checksums
99068b276bcf6ce3395aa45ab07899b9d5721edef59f6f336dcfd6bd23231c05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Release files / aiolibdatachannel-2026.9.8-cp314-cp314-manylinux_2_34_aarch64.whl

Download URL aiolibdatachannel-2026.9.8-cp314-cp314-manylinux_2_34_aarch64.whl
Size 4.9 MB
Tags CPython 3.14 Linux glibc 2.34+ ARM64
SHA-256 checksum
How to use checksums
ae293e741c5be5f18693075de08381995ffe96334e947bc576d99f061c37bc98
BLAKE2b-256 checksum
How to use checksums
07a3d833b7319a2fc11ca2b5240d990014eef505dd140c8c88e7e429708220bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Release files / aiolibdatachannel-2026.9.8-cp314-cp314-macosx_14_0_arm64.whl

Download URL aiolibdatachannel-2026.9.8-cp314-cp314-macosx_14_0_arm64.whl
Size 4.5 MB
Tags CPython 3.14 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
1ab58486d913904afe107bac73d90426d5769fa372a40613647cb54e91e5c86c
BLAKE2b-256 checksum
How to use checksums
f209318e6bd85cb9485deee944dc848e325545f94cfb7434741909c463a00d25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Release files / aiolibdatachannel-2026.9.8-cp313-cp313-manylinux_2_34_x86_64.whl

Download URL aiolibdatachannel-2026.9.8-cp313-cp313-manylinux_2_34_x86_64.whl
Size 5.2 MB
Tags CPython 3.13 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
c5e23183aa06cf8e083f97150a5c931ebce50a7a588b4956dd051219518c6e86
BLAKE2b-256 checksum
How to use checksums
6e3863973f8d6c50b3dfade5334bd0839b5f0183aea0536cf2e71d2d1f5438fd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Release files / aiolibdatachannel-2026.9.8-cp313-cp313-manylinux_2_34_aarch64.whl

Download URL aiolibdatachannel-2026.9.8-cp313-cp313-manylinux_2_34_aarch64.whl
Size 4.9 MB
Tags CPython 3.13 Linux glibc 2.34+ ARM64
SHA-256 checksum
How to use checksums
648aba9fae4bf58d7bde07c4dfd6a52c4d9b040179d07df233f1c0a060a695e9
BLAKE2b-256 checksum
How to use checksums
6954d7609d0756bd96a7e5c37181fe1e7b67e206dabaf2c84cd0215bbf020e5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Release files / aiolibdatachannel-2026.9.8-cp313-cp313-macosx_14_0_arm64.whl

Download URL aiolibdatachannel-2026.9.8-cp313-cp313-macosx_14_0_arm64.whl
Size 4.5 MB
Tags CPython 3.13 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
de9446282b9b94010ec4bf314f99e29bee947896b6f931d85afa89a1f2624044
BLAKE2b-256 checksum
How to use checksums
0bbdbb789947723be43dea704e5f98f6310eecfc3d6ca0bcd8e67f6963f253a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Release files / aiolibdatachannel-2026.9.8-cp312-cp312-manylinux_2_34_x86_64.whl

Download URL aiolibdatachannel-2026.9.8-cp312-cp312-manylinux_2_34_x86_64.whl
Size 5.2 MB
Tags CPython 3.12 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
d7b7ea04cedf78d976820207a5717f4b6020312e21dd7e7ead1b0b12928ae2bd
BLAKE2b-256 checksum
How to use checksums
794c1416d8da1eb22eec0a43e4fa621c657f83eca9754ba85cdcd17057ab55ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Release files / aiolibdatachannel-2026.9.8-cp312-cp312-manylinux_2_34_aarch64.whl

Download URL aiolibdatachannel-2026.9.8-cp312-cp312-manylinux_2_34_aarch64.whl
Size 4.9 MB
Tags CPython 3.12 Linux glibc 2.34+ ARM64
SHA-256 checksum
How to use checksums
7985bd69326b47cebe6d7eff24a059d7b74407a317f0573dabb6b33021f51b8b
BLAKE2b-256 checksum
How to use checksums
91ed2a61e74d1cdde01454a29920860995b3a8c68a586af807c12ad47ccb060a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Release files / aiolibdatachannel-2026.9.8-cp312-cp312-macosx_14_0_arm64.whl

Download URL aiolibdatachannel-2026.9.8-cp312-cp312-macosx_14_0_arm64.whl
Size 4.5 MB
Tags CPython 3.12 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
a7a01eaba4883ecf889bbcf8703d91f4a41cedceff55d0571c1098db28d03c93
BLAKE2b-256 checksum
How to use checksums
ed5b143a54330d1401e6150390af9048339e37d3573e5c3317ab58eac6809135
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2026.9.8 This release

10 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page