Skip to content

Latest commit

 

History

History
74 lines (55 loc) · 1.89 KB

README.md

File metadata and controls

74 lines (55 loc) · 1.89 KB

Simple Multi-user Single-room Realtime Webchat App

A multi-user single-room real-time web chat application built with aiohttp and asyncio, featuring real-time communication through WebSocket.

Prerequisites

  • Python 3.11
  • Poetry (if running with plain Python)
  • Docker and Docker Compose

How to Run

Using Docker Compose

  1. Clone repository
git clone https://github.com/seedspirit/lablup-toy-project.git
  1. Change into project directory
cd lablup-toy-project
  1. Run docker-compose command
# Run in single thread mode
docker compose up --build

# Run in multi-process mode (set workers according to your CPU cores)
APP_MODE=multi-process APP_WORKERS=4 docker compose up --build
  1. You can access app in localhost or 127.0.0.1 (using 80 port)

Note: Since the application uses session id in cookies for user identification, you can test multi-user chat scenarios by opening Chrome's Incognito window for each additional user.

image

Using plain python

  1. Clone repository
git clone https://github.com/seedspirit/lablup-toy-project.git
  1. Change into project server directory
cd lablup-toy-project/backend
  1. Download dependencies
poetry install
  1. Run Redis with Docker
docker run -d --name redis -p 6379:6379 redis
  1. Run application with python3 & poetry
# Run in single thread mode
poetry run python3 main.py
# or
poetry run python3 main.py --mode thread

# Run in multi-process mode (set workers according to your CPU cores)
poetry run python3 main.py -m multi-process -w 4
  1. You can access app in localhost or 127.0.0.1 (using 80 port)

Note: Since the application uses session id in cookies for user identification, you can test multi-user chat scenarios by opening Chrome's Incognito window for each additional user.

image