SkillAgentSearch skills...

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/Nexus
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

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-connection model to handle thousands of clients concurrently.
  • Thread-Safe Concurrency: Implements std::mutex and std::lock_guard to 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

Architecture

Demo Screenshot

Demo

Load Testing Screenshot

Testing

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)

  1. Open test.html in two separate browser tabs.
  2. Click "Connect" in both tabs.
  3. Type a message in one tab and click "Send".
  4. 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.

  1. Navigate to the test directory:
    cd nexus_test
    
  2. Install the dependencies:
    npm install
    
  3. Run the test script (while your C++ server is running):
    node test.js
    
  4. 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.
View on GitHub
GitHub Stars16
CategoryDevelopment
Updated2d ago
Forks0

Languages

C++

Security Score

75/100

Audited on Apr 7, 2026

No findings