cmkl/spring-2025/sen-109/00010/rust-chat-server/tui/README.md

2.2 KiB

🎮 Rust Chat Server - TUI Client

The tui binary provides a terminal-based UI for the rust-chat-server. This interface communicates with the server using a TCP client via our comms library.

TUI Demo


🛠 Technical Stack

🏗 Architectural Overview

High Level Architecture

  1. State Store & UI Management Loop: On startup, the application initializes loops for both State Store and UI Management, and sets up channels for State Updates and User Actions.
  2. UI Management:
    • Pages and Components sub-modules separate UI-related logic, resembling the structural design in modern web SPAs.
    • State-linked components can emit User Actions like server connection requests, room joins, and message sends.
    • A dedicated loop orchestrates the UI updates based on both state changes and terminal events.
  3. State Store:
    • State Store subscribes to User Actions to manage server connections and commands.
    • Upon processing User Actions or Server Events, State Store pushes the new state to the State Channel for UI updates.

🚀 Quick Start

Run the TUI client using cargo run or cargo run --bin tui. Upon bootstrap, you will be asked to enter a server address. The server address field will default to localhost:8080. Press <Enter> after entering the server you want to connect to.

Server disconnections will trigger a state reset, requiring re-login.