WebSocket++
0.8.3-dev
C++ websocket client/server library
|
Processors encapsulate the protocol rules specific to each WebSocket version. More...
Namespaces | |
constants | |
Constants related to processing WebSocket connections. | |
error | |
Error code category and codes used by all processor types. | |
error_cat | |
Processor class related error codes. | |
Classes | |
class | hybi00 |
Processor for Hybi Draft version 00. More... | |
class | hybi07 |
Processor for Hybi Draft version 07. More... | |
class | hybi08 |
Processor for Hybi Draft version 08. More... | |
class | hybi13 |
Processor for Hybi version 13 (RFC6455) More... | |
class | processor |
WebSocket protocol processor abstract base class. More... | |
Functions | |
template<typename request_type > | |
bool | is_websocket_handshake (request_type &r) |
Determine whether or not a generic HTTP request is a WebSocket handshake. More... | |
template<typename request_type > | |
int | get_websocket_version (request_type &r) |
Extract the version from a WebSocket handshake request. More... | |
template<typename request_type > | |
uri_ptr | get_uri_from_host (request_type &request, std::string scheme) |
Extract a URI ptr from the host header of the request. More... | |
Processors encapsulate the protocol rules specific to each WebSocket version.
The processors namespace includes a number of free functions that operate on various WebSocket related data structures and perform processing that is not related to specific versions of the protocol.
It also includes the abstract interface for the protocol specific processing engines. These engines wrap all of the logic necessary for parsing and validating WebSocket handshakes and messages of specific protocol version and set of allowed extensions.
An instance of a processor represents the state of a single WebSocket connection of the associated version. One processor instance is needed per logical WebSocket connection.
uri_ptr websocketpp::processor::get_uri_from_host | ( | request_type & | request, |
std::string | scheme | ||
) |
Extract a URI ptr from the host header of the request.
request | The request to extract the Host header from. |
scheme | The scheme under which this request was received (ws, wss, http, https, etc) |
Definition at line 136 of file processor.hpp.
int websocketpp::processor::get_websocket_version | ( | request_type & | r | ) |
Extract the version from a WebSocket handshake request.
A blank version header indicates a spec before versions were introduced. The only such versions in shipping products are Hixie Draft 75 and Hixie Draft 76. Draft 75 is present in Chrome 4-5 and Safari 5.0.0, Draft 76 (also known as hybi 00 is present in Chrome 6-13 and Safari 5.0.1+. As differentiating between these two sets of browsers is very difficult and Safari 5.0.1+ accounts for the vast majority of cases in the wild this function assumes that all handshakes without a valid version header are Hybi 00.
r | The WebSocket handshake request to read. |
Definition at line 107 of file processor.hpp.
bool websocketpp::processor::is_websocket_handshake | ( | request_type & | r | ) |
Determine whether or not a generic HTTP request is a WebSocket handshake.
r | The HTTP request to read. |
Definition at line 68 of file processor.hpp.