Skip to content
Ciaran Moran edited this page Apr 8, 2023 · 26 revisions

Information below refers to version 0.3.x

The information here represents selected excerpts from the WebSocket++ 0.3.x User Manual available in full form on the project website at http://www.zaphoyd.com/websocketpp/

Version 0.3 will be the final version of the library. It is currently in development and can be found in the ‘experimental’ branch of the project. The 0.3.x branch is a complete RFC6455 WebSocket implementation and strictly passes every Autobahn test. The application facing API is presently incomplete. The 0.3 information below documents the application facing API as it has been implemented so far.

Overview & Project Goals

WebSocket++ is a C++ library that can be used to implement WebSocket functionality. The goals of the project are to provide a WebSocket implementation that is simple, portable, flexible, lightweight, low level, and high performance.

WebSocket++ is not intended to be used alone as a web application framework or full featured web services platform. As such the components, examples, and performance tuning are geared exclusively towards operation as a WebSocket client or server. There are some minimal convenience features that stray from this (for example the ability to respond to HTTP requests other than WebSocket Upgrade requests) but these are not the focus of the project. In particular WebSocket++ does not intend to implement any non-WebSocket related fallback options (ajax / long polling / comet / etc).

In order to remain compact and improve portability, the WebSocket++ project strives to reduce or eliminate external dependencies where possible and appropriate. WebSocket++ core has no dependencies other than the C++11 STL. For non-C++11 compilers the Boost libraries provide drop in polyfills for the C++11 functionality used.

WebSocket++ implements a pluggable data transport component. The default component allows reduced functionality by using STL iostream. This component has no non-STL dependencies and can be used in a C++11 environment without Boost. Also included is a Boost ASIO based transport component that provides full featured network client/server functionality. This component requires Boost ASIO. As an advanced option, WebSocket++ supports custom transport layers if you want to provide your own using another library.

In order to accommodate the wide variety of use cases WebSocket++ has collected, the library is built in a way that most of the major components are loosely coupled and can be swapped out and replaced. WebSocket++ will attempt to track the future development of the WebSocket protocol and any extensions as they are developed.

Getting Started

WebSocket++ code is available on github at https://github.com/zaphoyd/websocketpp
The official project homepage lives at http://www.zaphoyd.com/websocketpp

The WebSocket++ repository is organized into several directories:

  • examples: Example programs that demonstrate how to build basic versions of some commonly used patterns for WebSocket clients and servers.
  • test: Unit tests that confirm that the code you have works properly and help detect platform specific issues.
  • websocketpp: All of the library code and default configuration files.

The official build system for the examples and unit tests is scons. If you are not building the examples or unit tests scons is not needed. More Information: Building the Examples and Unit Tests

WebSocket++ is a header only library. You can start using it by including the websocketpp source directory in your project’s include path and including the appropriate WebSocket++ headers in your program. You may also need to include and/or link to appropriate Boost/system libraries. More information: Building a program with websocketpp, Walkthroughs of the example programs

Questions, bugs, and issues should be posted to the project GitHub issues queue. If you are using the 0.3.x branch please tag any issues with the 0.3.x label.

WebSocket++ is written and maintained by Peter Thorson. You can contact me via GitHub messaging or via email at websocket@zaphoyd.com.


Information below refers to version 0.2.x

overview
role::server
role::client

examples


Information below refers to version 0.1.x

WebSocket++ is a C++ websocket library implemented using the Boost Asio networking stack. It is designed to provide a simple interface to allow you to quickly build modules that implement the back end functionality needed by realtime browser applications. WebSocket++ handles all of the networking and websocket protocol negotiation and provides an asynchronous “concurrency without threads” API to your application based on Boost Asio’s proactor design pattern.

API