Skip to content

Repository files navigation

wscpp

Lightweight WebSocket stack for C++11 with optional TLS (wss://).

This repository also ships ws-rs — a Rust reimplementation of the same protocol stack (rust/ws-rs), with independent SemVer and C++-parity benchmarks.

Experimental / AI-built. wscpp is an experimental library, not a production-grade product. The entire codebase was created with AI coding agents (LLMs); humans curate tests, CI, and releases, but you should expect gaps, API churn, and undiscovered bugs. Do not use in production without independent review.

CI

Features

  • C++11, no Boost required (standalone ASIO 1.20 via FetchContent, or Linux POSIX sockets)
  • OpenSSL TLS for secure WebSocket
  • Client and server with callback-based API; std::error_code on I/O (no exceptions)
  • Optional internal diagnostics via spdlog (WSCPP_ENABLE_LOGGING, default ON)
  • RFC 6455 framing + RFC 7692 permessage-deflate (opt-in)
  • ws-rs Rust companion crate (rust/ws-rs, independent SemVer)
  • CMake build, SemVer versioning, Doxygen API docs

Version: 1.1.0 (C++ wscpp) · 0.4.0 (ws-rs)

Quick build (C++)

git clone https://github.com/gvtret/wscpp.git
cd wscpp
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
cd build && ctest --output-on-failure

Quick build (Rust / ws-rs)

cd rust
cargo test --workspace -- --test-threads=1
cargo run -p echo_server --release -- 8080
cargo run -p echo_client --release -- ws://127.0.0.1:8080/ hello

See rust/README.md for wss://, blocking API, and benchmarks.

Documentation

Document Description
User guide Install, quick start, FAQ
Developer guide Architecture, testing, releases
Examples ws:// and wss:// echo programs
Analysis C++11 WebSocket library comparison
Rust workspace ws-rs quick start, examples, benchmarks
Rust guide ws-rs architecture, API, fmt/clippy, releases
Rust analysis ws-rs vs tokio-tungstenite, fastwebsockets, …
Changelog Release history
AGENTS.md Guidelines for AI coding agents working on this repo
API reference cmake --build build --target docsbuild/docs/html/index.html

Examples

# Terminal 1
./build/bin/wscpp_example_server 8080

# Terminal 2
./build/bin/wscpp_example_client ws://127.0.0.1:8080/

See examples/README.md for TLS (wss://) setup.

License

MIT — see LICENSE.

About

Websocket library

Resources

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages