Version: 0.5
This repository contains a simple terminal-based chat application built in Rust, leveraging asynchronous programming and multithreading for real-time communication. The application consists of a server and a client, allowing multiple users to connect and chat in a shared terminal environment. You can run several separate terminal clients and emulate users talking. Created and tested on Fedora 40. The development is still ongoing and will continue for the time being. This is a hobby project of mine and a proof of concept rather than a proper application.
Here is a screenshot of TermTalk in action (terminal used in the picture: Terminator):
- New UI functionality: Now you can see list of active users by pressing Ctrl+L.
- Reworked logic: Now instead of redundant code everthing is in utlis lib and logging.
- UI improvements: Interface now prompting wich key is for quit or return from user list.
- Improved UI Responsiveness: Optimized the terminal interface for smoother updates.
- Improved mentioned highlighting: Now tag @all is highlited for all logged in users.
- Username check: Server now checks if logging in username is already online and prompts user for new one.
- Enhanced Error Handling: Improved error messages for better debugging.
- Code Optimization: Reduced redundant processing for better performance.
- Run scripts for server and client: Scripts will build apps using
cargo run
If the project is built already, they will run only binaries. - Real-time messaging: Send and receive messages instantly with other connected users.
- Asynchronous I/O: Built using
tokiofor efficient handling of multiple clients. - Terminal UI: Clean and intuitive terminal interface powered by
tuiandcrossterm. - Mention highlighting: Mentions (e.g.,
@username) are highlighted for better visibility. - Ping-Pong mechanism: Ensures clients remain connected to the server.
The application is divided into two components:
- Server: Manages client connections, broadcasts messages, and handles disconnections.
- Client: Connects to the server, sends messages, and displays the chat interface.
Messages are broadcast to all connected clients in real-time, with timestamps and colored usernames for clarity.
- Rust and Cargo: Ensure you have Rust installed. If not, install it from rustup.rs.
- Unix-like environment: Tested on Fedora 40, but should work on other Linux distributions, macOS and FreeBSD.
git clone https://github.com/Peter-L-SVK/termtalk.git
cd termtalkThe included BASH scripts will also build the apps and run the binaries or build them straight away:
cargo build --releaseYou can run the included BASH server script to run the server on your machine or:
./target/release/serverThe server will start listening on 127.0.0.1:8080 by default or the configured address.
In a new terminal, you 74B6 can run the included BASH script for running the client or start the client manually:
./target/release/clientYou will be prompted to enter a username. Once connected, you can start chatting!
Modify the configuration file config.toml:
server_address = "127.0.0.1:8080"Adjust the layout and styling in client.rs using the tui crate.
This project uses the following Rust crates:
- tokio: Asynchronous runtime for networking.
- tui: Terminal user interface library.
- crossterm: Cross-platform terminal handling.
- chrono: Timestamp formatting.
- colored: Colored text output.
