A scalable, real-time WebSocket engine for synchronized live chats.
Resonate uses FastAPI for handling persistent connections and Redis Pub/Sub as a message broker, allowing thousands of users to chat and sync audio states across multiple server instances instantaneously.
In a standard WebSocket setup, if User A connects to Server 1 and User B connects to Server 2 (behind a load balancer), they cannot communicate because their sockets live in different memory spaces.
To solve this, Resonate implements the Broker Pattern:
- Ingest: When Server 1 receives a message, it publishes it to a Redis Channel.
- Broadcast: Redis pushes this message to all active server instances.
- Delivery: Every server listens to Redis and forwards the message to its own connected local users.
- Backend: FastAPI (Python 3.9+)
- Message Broker: Redis 7 (Alpine)
- Frontend: Vanilla JS + Tailwind CSS
- Infrastructure: Docker & Docker Compose
-
Clone the repository:
git clone https://github.com/damashiai/resonate.git cd resonate -
Start the Cluster:
docker-compose up --build
-
Access: Open
http://localhost:8000in your browser.
-
Start Redis:
docker run --name local-redis -p 6379:6379 -d redis:alpine
-
Install Dependencies:
python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate pip install -r requirements.txt
-
Run Server:
uvicorn main:app --reload
