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

Uploaded Python 3manylinux: glibc 2.28+ ARM64

aiolibdatachannel-2026.4.21.1-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.1.tar.gz.

File metadata

  • Download URL: aiolibdatachannel-2026.4.21.1.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.1.tar.gz
Algorithm Hash digest
SHA256 9512ac6fe423a85c7bd83b921286bc00a7343d65ddb9383173b6ae3399642828
MD5 48de9290192f3ad26d893a1a57ad35c7
BLAKE2b-256 246b5093d74ca792f0292fa89e4ef583ead4cb41739c669c3882856f6e1d706d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for aiolibdatachannel-2026.4.21.1-py3-none-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fd8f22987e25d14de7d84347012e3d06a57fd6531d7a553ebcb03b87d0bfe9a5
MD5 4d2747429d9321f0dd1372d1a90a5dca
BLAKE2b-256 cc8afd07be5ad4b6c7cf36e799fec07508a38ee43272f49d4bdc4fa3fdb05fea

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for aiolibdatachannel-2026.4.21.1-py3-none-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 992f25eb5959d46526eb0f97c896ad386837f354a9d71061b4879e9a6a68e052
MD5 3f7b11834414f5671b8e81ce677fa27c
BLAKE2b-256 a4917c4ea51eee18e10426acaf97f7dffe588e28dfa7ed1883e014fa08cce5fc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for aiolibdatachannel-2026.4.21.1-py3-none-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 5591cc4c963ee29ed0735bda09bcac812c8dbe7917c5324939cfd64f5460726d
MD5 fb3a4d792cbe0591f818d92f8aca4024
BLAKE2b-256 c6b61dac1ea1ca9a9c93baff0c1a28c40ebb27d51ab5c217ccd6f54971976575

See more details on using hashes here.

Provenance

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