Nexus
Multithreaded chat app server built on top of my own websocket echo server from scratch. Load-tested for 1,000 clients with highest throughput of 17000 msg/sec. Built in C++.
Install / Use
/learn @aryan55254/NexusREADME
Nexus: Multithreaded WebSocket ChatApp Server From Scratch
A high-performance, multithreaded WebSocket group chat server built from scratch in C++.
Overview
- Implements the full WebSocket protocol (RFC 6455) using Pulse (my own synchronous protocol implementation) as the template for the handshake and frame parsing logic.
- Multithreaded Server: Uses a
thread-per-connectionmodel to handle thousands of clients concurrently. - Thread-Safe Concurrency: Implements
std::mutexandstd::lock_guardto prevent race conditions when accessing the shared client list. - Group Chat (Broadcast): Built with a high-performance "Lock, Copy, Unlock, Send" pattern to efficiently broadcast messages.
- Load Tested: Proven to handle 1,000 concurrent clients with a peak throughput of over 17,000 messages/second.
Architecture & Demo
Architecture Diagram

Demo Screenshot

Load Testing Screenshot

Setup Guide
1. Dependencies
Required packages:
- g++
- OpenSSL development library
Install on Ubuntu/Debian:
sudo apt-get install g++ libssl-dev
2. Compilation
Make the compile script executable:
chmod +x compile.sh
Build the server:
./compile.sh
3. Running
Start the server:
./server
You should see: Server listening on port 8080...
Testing
1. Group Chat Test (2 Clients)
- Open
test.htmlin two separate browser tabs. - Click "Connect" in both tabs.
- Type a message in one tab and click "Send".
- The message will appear as "You: ..." in your tab and "Someone: ..." in the other tab.
2. Load Test (1,000+ Clients)
The nexus_test directory contains a script to simulate concurrent users.
- Navigate to the test directory:
cd nexus_test - Install the dependencies:
npm install - Run the test script (while your C++ server is running):
node test.js - Observe the console output as your server handles the 17k msg/s(expect 11k - 12k average highest it went was 17k on my computer) load.
