GithubHelp home page GithubHelp logo

aljanabim / simple_webrtc_python_client Goto Github PK

View Code? Open in Web Editor NEW
16.0 2.0 3.0 65 KB

A WebRTC Client in Python using aiortc with some useful examples.

Shell 0.69% Python 99.31%
webrtc peer-to-peer aiortc signaling signaling-cha

simple_webrtc_python_client's Introduction

Simple WebRTC Python Client

WebRTC is an evolving technology for peer-to-peer communication on the web. This repository demonstrates how this technology can be used to establish a peer connection from a Python instance. The networking topology is based on a meshed network. Any successful WebRTC connection requires a signaling server for the peers to exchange ICE candidates and session description protocol (SDP). The WebRTC client in this repository is compatible with the signaling server created in the following repository.

Table of Contents

Installation

We recommend using Conda or (Miniconda) to manage the packages and versions of this WebRTC Python Client. You are free to choose your version manager of choice (eg. pyenv or plain pip), in that case have a look at environment.yml to see what packages you need to install. Below are the installation instructions using Miniconda.

git clone https://github.com/aljanabim/simple_webrtc_python_client.git
cd simple_webrtc_python_client
conda env create -f environment.yml
conda activate webrtc

Usage

This client works out of the box with the signaling server created in the Simple WebRTC Signaling Server repository. Make sure you have a running local or deployed instance of the signlaing server before proceeding. You can use the signaling server locally, to play with the client logic and the examples, or deploy it on the web using your deployment service of choice (eg. Heroku, GCP, AWS, Azure, Vercel, Netlify, etc.).

Development

For development make sure to update the environment variables, in /config/dev.env, according to the configuration of your signaling server. Then run:

python main.py dev [--id]

For example, python main.py --dev --id=vehicle1, where --id denotes the peer ID to use for the client. This ID must be unique for each peer. If not specified, the machine hostname will be used.

Once you have everything up and running it is time to either play with the examples or to Implement your own logic

Production

For production make sure to update the environment variables, in /config/dev.env, according to the configuration of your signaling server. Then run:

python main.py [--id]

For example, python main.py --id=vehicle1, where --id denotes the peer ID to use for the client. This ID must be unique for each peer. If not specified, the machine hostname will be used.

Once you have everything up and running it is time to either play with the examples or to Implement your own logic

Issues so far

When a Node.js peer (using wrtc) is polite (reciever), all works well. But when the Node.js peer is the offerer (we are polite), the data channel never opens. This issue doesn't occur when Python clients are connecting to each other

Installing aiortc on Aarch64 might require needing to do the following steps PyAV-Org/PyAV#619 (comment)

simple_webrtc_python_client's People

Contributors

aljanabim avatar tbolin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.