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 (v0.1): PeerConnection + DataChannel only. WebSocket and Media/RTP transport are deliberately disabled in this build to keep the wheel small. See the "Roadmap" section below.

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.

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.

Roadmap

  • WebSocket client + server support (NO_WEBSOCKET=OFF)
  • Media / RTP tracks (NO_MEDIA=OFF)
  • First-class logging integration with rtcInitLogger
  • Trio / AnyIO variant

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.21.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.21-py3-none-manylinux_2_28_x86_64.whl (7.2 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ x86-64

aiolibdatachannel-2026.4.21-py3-none-manylinux_2_28_aarch64.whl (6.8 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

aiolibdatachannel-2026.4.21-py3-none-macosx_14_0_arm64.whl (5.3 MB view details)

Uploaded Python 3macOS 14.0+ ARM64

File details

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

File metadata

  • Download URL: aiolibdatachannel-2026.4.21.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.21.tar.gz
Algorithm Hash digest
SHA256 8970a3828b5e79dfe4689f25f7ac2385c444ed27e8f1cae45fb17c4ba281ca88
MD5 5235b9a22298e1d213da27447a9ad3ee
BLAKE2b-256 8722297b8d36bb0644703c3091ac8d037c1c189f974e58f22d63a0542698545c

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolibdatachannel-2026.4.21.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.21-py3-none-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for aiolibdatachannel-2026.4.21-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6b4e8615d48d4ff42ff920e72d6644ce859d50adce45164ddb46a8d5a6f69a47
MD5 3f83435fb1d2abfc9a4cff05f7f91f3d
BLAKE2b-256 90176a3c14584898f428aab1a1f90369bb7680690ca9e584001682e801035d57

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolibdatachannel-2026.4.21-py3-none-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.21-py3-none-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for aiolibdatachannel-2026.4.21-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1a3b23854ba5d57de68044d79ed13ca523bc0fdff684c2f7f6ba09d5f366cc4d
MD5 c1aed7fe6cc0238d3c03ff07c3ae232f
BLAKE2b-256 019abb1dbf644996eb734cee41b7e71a5f1dc618a705131c124f357153cd1a8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolibdatachannel-2026.4.21-py3-none-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.21-py3-none-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for aiolibdatachannel-2026.4.21-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 b810f0ccbe1184f77427cff21e8b2a0c5b6ff2ea04e7b389359b599b6edb6428
MD5 21983886f45a00326641d45966be3480
BLAKE2b-256 4f55a718c2cb6e0b9de7922bc998b7681c351e89417f95f6c5f124aaa8d0d8e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiolibdatachannel-2026.4.21-py3-none-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