Skip to main content

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

Reason this release was yanked:

Wrong release number schema

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_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.

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.9.5.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.9.5-cp314-cp314-manylinux_2_34_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

aiolibdatachannel-2026.9.5-cp314-cp314-manylinux_2_34_aarch64.whl (4.8 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ ARM64

aiolibdatachannel-2026.9.5-cp314-cp314-macosx_14_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.14macOS 14.0+ ARM64

aiolibdatachannel-2026.9.5-cp313-cp313-manylinux_2_34_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

aiolibdatachannel-2026.9.5-cp313-cp313-manylinux_2_34_aarch64.whl (4.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ ARM64

aiolibdatachannel-2026.9.5-cp313-cp313-macosx_14_0_arm64.whl (4.5 MB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

aiolibdatachannel-2026.9.5-cp312-cp312-manylinux_2_34_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

aiolibdatachannel-2026.9.5-cp312-cp312-manylinux_2_34_aarch64.whl (4.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ ARM64

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

Uploaded CPython 3.12macOS 14.0+ ARM64

File details

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

File metadata

  • Download URL: aiolibdatachannel-2026.9.5.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.9.5.tar.gz
Algorithm Hash digest
SHA256 25fc6529d4721578049a060410cd085e9dfc0bbc3c030bc3e343dbdb451e7824
MD5 65235761fa893e8ada0338402cabf9ad
BLAKE2b-256 c6bf7fdcaabe52cc91733bd9d28b014b807809a228904691c127e53e1bfd8f8e

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolibdatachannel-2026.9.5.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.9.5-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for aiolibdatachannel-2026.9.5-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 af1f20b5263c5e1883f3e1a70bfe762c8d11bf487d9475b8fbcde666c4e82891
MD5 c841ccd0b896ab82a909da5bccbe3bf7
BLAKE2b-256 b236c01553ec6dbe3bfd6788f54eccf709362f034a6028e01c482ed97852e73d

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolibdatachannel-2026.9.5-cp314-cp314-manylinux_2_34_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.9.5-cp314-cp314-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for aiolibdatachannel-2026.9.5-cp314-cp314-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 6d1414fc1621f4309dc98b377c4d813d267059e8e0f7c68c15dfaf6a262bd006
MD5 9827a8787d200d275bbb1cbeaa098f97
BLAKE2b-256 5064c1deb430d903d5df6e1f7bf7de6c96b690ad6035a429b3d65f1182183467

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolibdatachannel-2026.9.5-cp314-cp314-manylinux_2_34_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.9.5-cp314-cp314-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for aiolibdatachannel-2026.9.5-cp314-cp314-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 7fb40521636f93de0cdef92958950f2158e1b95bcb9f89163db883960009342e
MD5 67fc6b641428cd94aafc0617d12a3485
BLAKE2b-256 e84283910ad8126554f635adafb624a6db803f60ce1fb1edf8dfeb92cfe351c8

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolibdatachannel-2026.9.5-cp314-cp314-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.

File details

Details for the file aiolibdatachannel-2026.9.5-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for aiolibdatachannel-2026.9.5-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 48a9a95f9e128d83549560c4fa353e5a595f43b70455d7dce8fdda1386c2ddc2
MD5 f18d32c678dbbe770be4ef47901e1123
BLAKE2b-256 2f03564940aa2d2ff4c72d335aca1ddfdf3cc406f66089e14e508bbf9f2810a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolibdatachannel-2026.9.5-cp313-cp313-manylinux_2_34_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.9.5-cp313-cp313-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for aiolibdatachannel-2026.9.5-cp313-cp313-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 3be7bafc24fae89d885d08a852402df787bfa59c086937086a05e4d89b93836b
MD5 3f3b07b4d13f829b7cc789909883c973
BLAKE2b-256 d18ee833d762eeb92f42d50011181070da738fbeead5c3adbc2d5831795cb5dc

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolibdatachannel-2026.9.5-cp313-cp313-manylinux_2_34_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.9.5-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for aiolibdatachannel-2026.9.5-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 03de744975b291ed426a0157c4999afdca220f7c7989ad711af466b2ecdb0444
MD5 3c5c869f8670b0267b1fceac7e2a03fd
BLAKE2b-256 84dc4db93823a153be8d6083bd4a200f1333fec584e842798b02aeb0bcc6d837

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolibdatachannel-2026.9.5-cp313-cp313-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.

File details

Details for the file aiolibdatachannel-2026.9.5-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for aiolibdatachannel-2026.9.5-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 0c16a2e34a1020c9fa838fcb4d271b22ccfa917ae8cc337464ac7f0abe4f7af1
MD5 40fc1c60ccd331b2e9272924f45bb153
BLAKE2b-256 5fdea5fac703f952bc31346fa76225ccbcd9d24fc4debe3c510ff441883a8664

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolibdatachannel-2026.9.5-cp312-cp312-manylinux_2_34_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.9.5-cp312-cp312-manylinux_2_34_aarch64.whl.

File metadata

File hashes

Hashes for aiolibdatachannel-2026.9.5-cp312-cp312-manylinux_2_34_aarch64.whl
Algorithm Hash digest
SHA256 7057bb722768c158f7c0124c284aa4109c5ddabaabf01c5b7e239ec7d2d71df8
MD5 d30d21956397429485ada52130a96cc6
BLAKE2b-256 d01e973296761b0e4e81eb088bf4200835a02388131eef8044114daf1b5ccda6

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolibdatachannel-2026.9.5-cp312-cp312-manylinux_2_34_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.9.5-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for aiolibdatachannel-2026.9.5-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 730698e496d8656cc4f14d279a0a2de1c9273c76e546522b96b068ba41eea904
MD5 a00ab7863c1471d649a65f9d2fa03db9
BLAKE2b-256 08de91069799c8aedfa5f8a71ca23bf274fa5bccffd36845732c5131be985e47

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolibdatachannel-2026.9.5-cp312-cp312-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