A robust real-time video conferencing platform built with Django, Django Channels (WebSockets), and the Agora SDK. This application facilitates stable audio/video communication and persistent real-time chat with low latency.
This project integrates WebRTC via the Agora SDK for high-quality video streaming and utilizes Django Channels to handle WebSocket connections for a seamless chat experience. It is designed to handle concurrent users efficiently with a focus on minimal latency and secure session management.
- Real-Time Video/Audio: Leverages Agora SDK to ensure stable communication with adaptive bitrate streaming.
- Persistent Chat: WebSocket-based chat system implemented using Django Channels.
- Performance: Tested with ~20–30 concurrent users per room.
- Speed: Average message delivery latency reduced to <200ms via persistent connections.
- Secure Rooms: Token-based authentication and secure session handling to prevent unauthorized access to meeting rooms.
- Low Latency: Optimized architecture ensures synchronization between video streams and chat messages.
- Backend Framework: Django
- Real-time Protocol: Django Channels (Asynchronous Server Gateway Interface - ASGI)
- Video/Audio Engine: Agora RTC SDK (WebRTC)
- Database: SQLite (Development) / PostgreSQL (Production recommended)
- Message Broker: Redis (for Channel Layers)
- Frontend: HTML5, CSS3, JavaScript
Before running the project, ensure you have the following installed:
- Python 3.8+
- Redis (Required for Django Channels)
- An Agora.io Developer Account (for App ID)
-
Clone the Repository
git clone [https://github.com/yourusername/your-repo-name.git](https://github.com/yourusername/your-repo-name.git) cd your-repo-name -
Create and Activate Virtual Environment
python -m venv venv # Windows venv\Scripts\activate # Mac/Linux source venv/bin/activate
-
Install Dependencies
pip install -r requirements.txt
-
Configure Environment Variables Create a
.envfile in the root directory and add your Agora credentials:SECRET_KEY=your_django_secret_key DEBUG=True AGORA_APP_ID=your_agora_app_id AGORA_APP_CERTIFICATE=your_agora_certificate
-
Start Redis Server Ensure Redis is running on port 6379.
redis-server
-
Run Migrations
python manage.py makemigrations python manage.py migrate
-
Start the Application Since we are using Django Channels, you might need to run via
daphneor the standard command ifasgi.pyis configured correctly.python manage.py runserver
- User Joins Room: The Django backend validates the session ID.
- Video Stream: The frontend initializes the Agora Client, connecting directly to Agora's SD-RTN (Software Defined Real-time Network).
- Chat Stream: The frontend opens a WebSocket connection (
ws://) to the Django Channels consumer. - Broadcasting: Redis acts as the channel layer, distributing chat messages to all connected clients in the room instantly.
Contributions are welcome!
- Fork the project.
- Create your feature branch (
git checkout -b feature/AmazingFeature). - Commit your changes (
git commit -m 'Add some AmazingFeature'). - Push to the branch (
git push origin feature/AmazingFeature). - Open a Pull Request.