Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gaems12/connection-hub

Repository files navigation

Connection Hub

Python version Code style Status of passing 'lint' job Status of passing 'test' job

📜 License

This project is licensed under the Personal Use License. See the LICENSE file for details.

📚 Table of Contents

📦 Dependencies

Ensure the following services are installed and running:

  • Redis
  • NATS
  • Centrifugo

🚀 Installation

Using uv

  1. Create and activate a virtual environment:

    uv venv --python 3.13
    source ./.venv/bin/activate
  2. Install dependencies:

    For development

    uv sync --all-extras --frozen

    For production

    uv sync --frozen

Using pip

  1. Create and activate a virtual environment:

    python3 -m venv .venv
    source ./.venv/bin/activate
  2. Install dependencies:

    For development:

    pip install -e ".[dev]"

    For production:

    pip install -e .

Using Docker

  1. Build Docker image:

    docker build -t connection_hub:latest .

⚙️ Environment Variables

Configure the following environment variables before running the application:

Variable Required Description Default
LOGGING_LEVEL No Logging level DEBUG
REDIS_URL No URL for the Redis instance. redis://localhost:6379
NATS_URL No URL for the NATS server. nats://localhost:4222)
CENTRIFUGO_URL Yes URL for the Centrifugo server. -
CENTRIFUGO_API_KEY Yes API key for Centrifugo. -
LOBBY_MAPPER_LOBBY_EXPIRES_IN No Lobby expiration time in seconds 86400
GAME_MAPPER_GAME_EXPIRES_IN No Game expiration time in seconds. 86400
LOCK_EXPIRES_IN No Lock expiration time in seconds. 5
TEST_REDIS_URL Yes (for tests) URL for the test Redis instance. -
TEST_NATS_URL Yes (for tests) URL for the test NATS server. -

🛠️ Commands

Create NATS Streams

Create NATS streams with all subjects used by application to test it:

connection-hub create-nats-streams <nats_url>

Run Message Consumer

Run the message consumer to process events from NATS:

connection-hub run-message-consumer

Run Task Scheduler

Run the task scheduler:

connection-hub run-task-scheduler

Run Task Executor

Run the task executor for scheduled tasks:

connection-hub run-task-executor

About

Backend for managing lobbies and player connections in the games.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •