WebSocket++ is a cross platform open source (BSD license) header only C++ library that implements RFC6455 (The WebSocket Protocol) and RFC7692 (Compression Extensions for WebSocket). It allows integrating WebSocket client and server functionality into C++ programs. In its most common configuration full featured network I/O is provided by the Asio Networking Library.
WebSocket++'s goal is to provide a flexible set of tools for building a wide variety of WebSocket based applications wrapped by low or zero overhead abstractions. It is not opinionated. If something can be practically replacable (with low overhead) based on the user's preference then it is. It accomplishes this via a policy based design built using C++ template metaprogramming. Bundled config packages provide sane defaults so most users can get started quickly. As they understand their solution better and want to optimize, the default components can be reconfigured or replaced entirely and transparently.
This design allows the library to flexibly integrate both into a program that already provides its own network handling and just needs something to decode a WebSocket byte sequence and into a program that wants all the network bits and bobs done for it and just wants to respond to some messages. A simple command line tool can read & interpret a Wireshark transcript and need no dependencies and a full featured network program can pull in Asio, OpenSSL, and zlib to support compressed, encryption connections. Finally, this flexibility allows the library to transparently use Boost based polyfills for the C++11 features needed, allowing full operation in C++03 environments.
Common Use Cases
WebSocket++ is largely feature complete. It fully supports the relevant RFCs. The library is actively maintained to develop documentation, fix bugs, and support newer build environments and versions of related libraries (OpenSSL, Asio, etc). Some additional development continues in the areas of new features and performance improvements as time allows.
If you are a user of WebSocket++ and want to contribute to its maintenance you can submit issues and PRs and answer questions on Github, sponsor me on Github Sponsors, or engage me for private WebSocket++ related consulting.
|Client & Server
|3 Clause BSD
|Header only C++
|Generally portable. Tested with Linux, macOS, Windows. GCC, LLVM/Clang, Visual Studio. Intel x64, i386, PowerPC, ARM. 32 and 64 bit. C++03 or later.
|Full support: RFC6455 and RFC7692
Partial support: Hixie draft 76, Hybi Drafts 7-17
|Flexible, depending on requirements. Core library requires only the C++11 STL (or several Boost polyfills for C++03 compilers). Some policies require third party libraries such as Asio, OpenSSL, and zlib.
|Configurable size limits, timeouts, flow control, and SSL/TLS encryption / Secure WebSockets (WSS) with fully customizable TLS settings (some features limited by transport policy).
|Manual Ping/Pong, fully configurable compression negotiation, binary and text message types.
|Message based. Syncronous or Asyncronous (depending on policies).
|(Asio transport policy) IPv6, outgoing explicit proxies (with basic auth), DNS resolution, basic pass through HTTP support.