Skip to content

harshithChukka/chat-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chat-app

Cross-platform TLS chat app built with Boost.Asio (C++20).

Overview

This project provides:

  • chat_server: async TLS chat server
  • chat_client: console TLS client with auto-reconnect
  • Length-prefixed JSON protocol (4-byte big-endian length + JSON payload)
  • Optional Python stress test for load testing

Features

  • TLS-encrypted client/server communication
  • Broadcast chat messages
  • Private/direct messages
  • Join/leave notifications
  • Multi-threaded server io_context execution
  • Automatic client reconnect on disconnect

Repository layout

  • server/ – server implementation
  • client/ – console client and networking
  • common/ – shared protocol and TCP framing utilities
  • certs/ – TLS cert and key (server.crt, server.key)
  • scripts/stress_test.py – asyncio-based stress/load tool

Prerequisites

  • CMake >= 3.16
  • C++20 compiler (g++/clang++)
  • Boost (System)
  • OpenSSL
  • POSIX Threads
  • nlohmann/json headers

Typical Ubuntu packages:

sudo apt-get update
sudo apt-get install -y build-essential cmake libboost-system-dev libssl-dev nlohmann-json3-dev

Build

From repository root:

cmake -S . -B build
cmake --build build -j

This produces:

  • build/chat_server
  • build/chat_client

Run

Open two terminals.

1) Start server

cd build
./chat_server

2) Start client

cd build
./chat_client <username>

If username is omitted, it defaults to Test-Client.

Client input format

The console client expects each line in this format:

<type>|<from>|<to>|<text>

Where <type> is one of:

  • Join
  • Chat
  • Private
  • Leave

Examples:

Chat|alice||Hello everyone!
Private|alice|bob|Hi Bob
Leave|alice||

Note: The client sends Join automatically right after TLS handshake, so manual Join is usually unnecessary.

Notes

  • TLS certificate/key paths are currently expected relative to running binaries from build/.
  • CMake also copies certs/ into build/certs, but runtime code currently loads from ../certs/....

About

Cross-Platform Chat App using Boost.Asio

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors