Skip to content

Shradhesh71/Async-Chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Async Chat

A multi-protocol chat server implementation in Rust demonstrating different networking approaches with async/await.

Overview

This project implements chat servers using various protocols, progressing from simple to advanced:

  1. TCP - Basic socket-based communication
  2. WebSocket - Bi-directional web-friendly protocol
  3. QUIC - Modern UDP-based protocol with built-in encryption
  4. HTTP/3 - Latest HTTP version built on QUIC

Features

  • 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

Project Structure

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

Getting Started

Installation

git clone <https://github.com/Shradhesh71/Async-Chat>
cd async-chat
cargo build --release

Learning Path

Follow this order to understand networking concepts progressively:

1. TCP Server (Basic)

Start here to understand fundamental socket programming.

# Terminal 1: Run server
cargo run --bin tcp-server

# Terminal 2: Run client
cargo run --bin tcp-client

2. WebSocket Server

Learn bi-directional communication over HTTP.

# Terminal 1: Run server
cargo run --bin websocket-server

# Terminal 2: Use browser or WebSocket client

3. QUIC Server

Explore modern UDP-based protocol with encryption.

# Terminal 1: Run server
cargo run --bin quic-server

# Terminal 2: Run client
cargo run --bin quic-client

4. HTTP/3 Server (Advanced)

Learn 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-client

Commands

Available in chat:

  • /who - List online users
  • /nick <name> - Change your username
  • /dm <user> <message> - Send direct message
  • /quit - Disconnect from server

Testing

Use the corresponding client in the clients/ directory to test each server implementation.

Dependencies

  • tokio - Async runtime
  • quinn - QUIC implementation
  • h3 / h3-quinn - HTTP/3 implementation
  • rustls - TLS library
  • bytes - Byte utilities

License

MIT

About

A multi-protocol chat server implementation in Rust demonstrating different networking approaches

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages