Skip to content

damashiai/resonate

Repository files navigation

Resonate

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.

Python Redis WebSockets Docker

The Problem & Solution

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:

  1. Ingest: When Server 1 receives a message, it publishes it to a Redis Channel.
  2. Broadcast: Redis pushes this message to all active server instances.
  3. Delivery: Every server listens to Redis and forwards the message to its own connected local users.

Tech Stack

  • Backend: FastAPI (Python 3.9+)
  • Message Broker: Redis 7 (Alpine)
  • Frontend: Vanilla JS + Tailwind CSS
  • Infrastructure: Docker & Docker Compose

Quick Start

Option 1: Docker (Recommended)

  1. Clone the repository:

    git clone https://github.com/damashiai/resonate.git
    cd resonate
  2. Start the Cluster:

    docker-compose up --build
  3. Access: Open http://localhost:8000 in your browser.

Option 2: Local Development

  1. Start Redis:

    docker run --name local-redis -p 6379:6379 -d redis:alpine
  2. Install Dependencies:

    python -m venv venv
    source venv/bin/activate  # Windows: venv\Scripts\activate
    pip install -r requirements.txt
  3. Run Server:

    uvicorn main:app --reload

Screenshot

About

A scalable, real-time WebSocket engine for synchronized live chats

Topics

Resources

Contributing

Stars

Watchers

Forks

Contributors