Skip to content

guptav96/webrtc-client-server

Repository files navigation

Nimble Programming Hackathon

Requirements

  • Ubuntu 22.04+
  • Python 3.10+
  • numpy
  • openCV
  • aiortc

Instructions

  1. Extract the compressed file. The structure should look like this:

├─ client
│   ├── client.py
│   ├── test_client.py
├─ server
│   ├── server.py
│   ├── test_server.py <br ├─ requirements.txt
├─ requirements.test.txt
├─ Dockerfile.client
├─ Dockerfile.server
├─ docker-compose.yml
├─ server-deployment.yaml
├─ client-deployment.yaml
├─ ballaction.mov
├─ README.md

  1. Navigate to the project directory and install the required dependencies.
pip install -r requirements.txt

It is a better practice to install OpenCV from source to run GUI applications. Link here

  1. To run the application, start the server using cd server; python3 server.py. This will start the server on localhost and default port 8080. Next start the client -> cd client; python3 client.py. The client will attempt to connect to the server using TCP connection and will start receiving the images of a bouncing ball across the screen.

  2. To run the unit tests, there are additional dependencies that need to be installed using pip install -r requirements.tests.txt. The tests can be then be run on command line using pytest -vv from the root directory.

Deployment

  1. Docker - Build the images for client and server using
docker build -t myserver:latest -f Dockerfile.server .
docker build -t myclient:latest -f Dockerfile.client .

Once the Docker image is built, run it in a container using the following commands:

docker run --name myserver-container --network host myserver:latest
docker run --name myclient-container --network host myclient:latest
  1. Kubernetes - Make sure you have a Kubernetes cluster set up and the kubectl command-line tool installed and configured to access your cluster. Deploy the Kubernetes resources by running the following commands:
minikube start
kubectl apply -f server-deployment.yaml
kubectl apply -f client-deployment.yaml

Verify that the resources have been created successfully by running the following command:

kubectl get deployments

About

A client-server protocol for a bouncing ball using aiortc, opencv and multiprocessing in python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages