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 |
---|---|---|
concurrency_type (Initial) |
Provides concurrency primitives | None Stub to disable concurrency overhead in single threaded situations. |
Basic Concurrency primitives based on those found in Boost or the C++11 STL |
||
request_type (Initial) |
Stores and manipulates HTTP requests | |
response_type (Initial) |
Stores and manipulates HTTP responses | |
message_type (Initial) |
Stores and manipulates WebSocket messages | |
con_msg_manager_type (Initial) |
Connection policy that manages messages | |
endpoint_msg_manager_type (Initial) |
Endpoint policy that manages messages | |
elog_type (2013-01-27) |
Provides error logging functionality | |
alog_type (2013-01-27) |
Provides access logging functionality | |
rng_type (2013-03-02) |
Provides random number generation | |
transport_type (Initial) |
Provides network I/O and timers | iostream A simple transport that uses iostream for input and output. |
asio Transport based on Asio (Either Boost or standalone) |
||
endpoint_base (2013-03-06) |
Provides user defined enriched policy for the endpoint. | Blank |
connection_base (2013-03-10) |
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. |
false |
Add new comment