A multi-protocol chat server implementation in Rust demonstrating different networking approaches with async/await.
This project implements chat servers using various protocols, progressing from simple to advanced:
- TCP - Basic socket-based communication
- WebSocket - Bi-directional web-friendly protocol
- QUIC - Modern UDP-based protocol with built-in encryption
- HTTP/3 - Latest HTTP version built on QUIC
- Real-time messaging between multiple clients
- User authentication with usernames
- Direct messaging between users
- Broadcast messages to all connected clients
- Commands:
/who,/nick,/dm,/quit
src/bin/
├── servers/
│ ├── tcp.rs - TCP chat server
│ ├── websocket.rs - WebSocket server
│ ├── quic.rs - QUIC server
│ └── http3.rs - HTTP/3 server
└── clients/
├── tcp.rs - TCP client
├── quic.rs - QUIC client
└── http3.rs - HTTP/3 client
git clone <https://github.com/Shradhesh71/Async-Chat>
cd async-chat
cargo build --releaseFollow this order to understand networking concepts progressively:
Start here to understand fundamental socket programming.
# Terminal 1: Run server
cargo run --bin tcp-server
# Terminal 2: Run client
cargo run --bin tcp-clientLearn bi-directional communication over HTTP.
# Terminal 1: Run server
cargo run --bin websocket-server
# Terminal 2: Use browser or WebSocket clientExplore modern UDP-based protocol with encryption.
# Terminal 1: Run server
cargo run --bin quic-server
# Terminal 2: Run client
cargo run --bin quic-clientLearn HTTP/3 built on QUIC with request/response model.
# Terminal 1: Run server
cargo run --bin http3-server
# Terminal 2: Run client
cargo run --bin http3-clientAvailable in chat:
/who- List online users/nick <name>- Change your username/dm <user> <message>- Send direct message/quit- Disconnect from server
Use the corresponding client in the clients/ directory to test each server implementation.
tokio- Async runtimequinn- QUIC implementationh3/h3-quinn- HTTP/3 implementationrustls- TLS librarybytes- Byte utilities
MIT