Python port of PeerJS client library.
Project description
peerjs-python
Python port of PeerJS client. Tracked in issue #160 of the official PeerJS project.
Enables Progressive Web Apps to discover and pair directly with Python apps using secure, browser supported WebRTC protocol.
Uses aiortc as Python WebRTC provider. This requires installing a few native dependencies for audio/video media processing.
On Debian/Ubuntu run:
apt install libavdevice-dev libavfilter-dev libopus-dev libvpx-dev pkg-config
On OS X run:
brew install ffmpeg opus libvpx pkg-config
Motivation
This project was originally motivated while searching for a way to:
- Connect a Progressive Web App (Ambianic UI) directly and securely to an edge device (Ambianic Edge) running Python app on a Raspberry Pi behind a home Internet router.
Other key requirements:
- Easy Airdrop-like plug and play discovery and pairing between web app and edge devices.
- Direct peer-to-peer connectivity to minimize:
- latency
- architecture complexity
- costs associated with traffic and hosting of tunneling servers
- exposure to public server security attacks
- Support for:
- Secure connections
- Bi-directional data-channel
- Low latency audio/video media streaming
- Bi-directional live audio/video media
- Rely only on standard broadly supported web browser features.
- Stable mobile device support (iOS, Android, Raspberry Pi)
- Stable desktop OS support (Windows, Mac OS, Linux)
- No need for browser plug-ins
- No intermediary cloud service providers to store and sync user data.
- No tedious and complicated NAT setups of dynamic DNS with SSH tunnels between public IP servers and edge devices behind firewall.
- High throughput and scalability via lightweight signaling service without a persistence layer.
Project Status
Initial working prototype completed. PeerJS Python is now able to connect over WebRTC DataChannel to PeerJS in the browser and exchange messages.
- Complete and test connectivity with signaling server (peerjs-server).
- Complete and test data channel connectivity with web app peers.
- >90% code coverage with CI tests.
- Release initial version to PyPi.
- Complete port and test media support.
Other Open Source projects
There are several great projects that solve the problem of accessing IoT devices behind firewall via tunneling servers.
- Python Proxy: Asynchronous tunnel proxy implemented in Python 3 asyncio.
- Proxy.py: HTTP proxy server written in Python.
- Inlets: Reverse proxy and service tunnel written in Go.
- Macchina.io: IoT tunneling proxy written in C++.
A few popular p2p projects that use WebRTC:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.