a very simple IRC clone using websockets and sqlite
You can read full german documentation here. Its got way more detailed information.
The client connects to the server and sends messages to the server. The server then broadcasts the message to all connected clients.
The client can choose a username and a "Group" or channel where the message will be send. This allows for multiple conversations to be happening at the same time on the same server. New clients can join the group and will receive all messages sent to that group.
Old messages are stored on the server in a sqlite database.
Download the latest release from the releases page and run the server and client.
- Install rust from https://www.rust-lang.org/tools/install
- Clone the repository
git clone https://github.com/Meisterlala/cli-chat.git
- Compile the server and client
cd cli-chat
cargo build --release
- Run the server
./target/release/chat_server
- Run the client
./target/release/chat_client
Enter the port you want the server to listen on.
Enter the IP and port of the server. Enter a username and a group. Then start chatting, when you press enter the message will be send. ESC or CTRL+C will close the client.
Its possible to see additional info by setting the environment variable RUST_LOG=info
or RUST_LOG=debug
before running the server or client. RUST_LOG=off
will disable most output.
All messages are stored in a single sqlite database and table. The server uses tokio for async IO and the client uses ratatui for terminal IO. Envlogger is used for logging. Communication between server and client is done via tungstenite websockets.
Chat Client, logged into "ws://127.0.0.1:9001" in the group "Hacker Chat" as "User 1"
User 1: Hello, how are you?
User 2: I'm doing fine
User 2: How about you?
User 1: Also good, check out this cool program
User 1: we can type and messages appear in real time
User 2: i think we live in the future, wow
┌Input───────────────────────────────────────────────────────────────────────────────────┐
│ very cool_ │
└────────────────────────────────────────────────────────────────────────────────────────┘