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.21.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.21.2-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.2-py3-none-manylinux_2_28_aarch64.whl (6.8 MB view details)

Uploaded Python 3manylinux: glibc 2.28+ ARM64

aiolibdatachannel-2026.4.21.2-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.2.tar.gz.

File metadata

  • Download URL: aiolibdatachannel-2026.4.21.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.21.2.tar.gz
Algorithm Hash digest
SHA256 98fdd538916d095d7bc4853a5a1030b21e7ae89b18d4ceb9f3aa81aa9a822a63
MD5 d6f11984558ae99d0ab0605102a18364
BLAKE2b-256 1b95253ad8f62a0220cf328ba8cabfc8ac5f29b69f87d05da7ccbd7ae0774f7b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for aiolibdatachannel-2026.4.21.2-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1dcea95b10953859ce259395d8aca779f45893a665d0b4ab25c584d3b748609b
MD5 aa9f90cd035f29f86e974992a83bec87
BLAKE2b-256 687144a8a875cfc5debf9d1122584a905b054ad85d1303c4ac63d5bb0291452b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for aiolibdatachannel-2026.4.21.2-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ce489cd2f73a8ea03f83cb80e134d3253afca6e7d2083518a045af4ed86d2283
MD5 f20186f850a5c45d8ff85bb9a40d479b
BLAKE2b-256 4b0223525cd5e5fdbc7b2518f221a33c4e89bfd2cc6350230613d3c25c962b82

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for aiolibdatachannel-2026.4.21.2-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 1a423d0adbaf3c0a5271143b8e9bbe28918619007c295494d7987b0b3c8412e2
MD5 b3983fef872360d0939d03c61d8839df
BLAKE2b-256 1ef7013e612a1cc32c88d7b18066b98488769bbd49fe08520679a6e1bf91419c

See more details on using hashes here.

Provenance

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