WebSocket++ endpoints take a single template parameter that defines a number of configuration types and values. These values allow you configure a number of policies at compile time. The config itself takes the form of a struct that defines a set of types and static const integral values. Multiple configs can be created and a single program can use multiple endpoints of each type. WebSocket++ ships with several default configs with common options. These configs can be used as is, or derived from to create customized configs.

Note: due to C++ not allowing inherited typedefs, custom configs must explicitly list every policy, even if it is to simply say "use the policy from the parent". As such, future versions of the library that introduce new policies may require existing programs to update custom configs accordingly.

Default Configurations

Config Description
core This is the core config. It contains default values for every integral setting and minimal dependency options for all other policies. Given a complete C++11 STL, the core config has no external dependencies. Without a C++11 STL it requires a number of Boost libraries. This config uses the iostream transport policy and has no inherent networking capabilities.
asio This config is similar to core but adds Asio Transport as the transport policy. It will create endpoints that can connect or listen to network sockets. This config uses plain sockets with no TLS/SSL based security.
asio_tls Similar to the asio config but with TLS/SSL support enabled. This config will create secure endpoints.

Full Policy List

Policy (introduced) Role Core options
Provides concurrency primitives None
Stub to disable concurrency overhead in single threaded situations.
Concurrency primitives based on those found in Boost or the C++11 STL
Stores and manipulates HTTP requests
Stores and manipulates HTTP responses
Stores and manipulates WebSocket messages
Connection policy that manages messages
Endpoint policy that manages messages
Provides error logging functionality
Provides access logging functionality
Provides random number generation
Provides network I/O and timers iostream
A simple transport that uses iostream for input and output.
Transport based on Asio (Either Boost or standalone)
Provides user defined enriched policy for the endpoint. Blank
Provides user defined enriched policy for connections. Blank

Full Value List

Value Description Default
connection_read_buffer_size Size of the per connection network read buffer in bytes. Larger values may improve performance at a cost of increased memory usage. Value should be a power of 2. 512
drop_on_protocol_error Drop connections on protocol error rather than sending a close frame. false
silent_close Suppress the return of detailed connection close
* information during the closing handshake.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.