A package of types and methods for manipulating WebSocket close codes.
status::value websocketpp::close::extract_code |
( |
std::string const & |
payload, |
|
|
lib::error_code & |
ec |
|
) |
| |
|
inline |
Extract a close code value from a close payload.
If there is no close value (ie string is empty) status::no_status is returned. If a code couldn't be extracted (usually do to a short or otherwise mangled payload) status::protocol_error is returned and the ec value is flagged as an error. Note that this case is different than the case where protocol error is received over the wire.
If the value is in an invalid or reserved range ec is set accordingly.
- Parameters
-
[in] | payload | Close frame payload value received over the wire. |
[out] | ec | Set to indicate what error occurred, if any. |
- Returns
- The extracted value
Definition at line 294 of file close.hpp.