Loading...
Searching...
No Matches
restinio::websocket::basic Namespace Reference

## Namespaces

namespace | impl

## Classes

class | message_t
| WebSocket message. More...
class | ws_t
| A WebSocket bind. More...

## Typedefs

using | ws_handle_t = std::shared_ptr< ws_t >
| Alias for ws_t handle.
using | byte_t = unsigned char
| Alias for byte.
using | raw_data_t = std::string
| Bytes buffer.
using | message_handle_t = std::shared_ptr< message_t >
| Request handler, that is the type for calling request handlers.
using | default_message_handler_t = std::function< void(message_handle_t) >

## Enumerations

enum class | opcode_t : std::uint8_t { RESTINIO_WEBSOCKET_OPCODES_GEN , unknown_frame = 0x0F }
enum class | status_code_t : std::uint16_t { normal_closure = 1000 , going_away = 1001 , protocol_error = 1002 , cant_accept_data = 1003 , no_status_provided = 1005 , connection_lost = 1006 , invalid_message_data = 1007 , policy_violation = 1008 , too_big_message = 1009 , more_extensions_expected = 1010 , unexpected_condition = 1011 }
enum class | final_frame_flag_t : std::uint8_t { final_frame , not_final_frame }
| WS frame (message) "final"/"not final" flag. More...
enum class | activation_t { immediate , delayed }
| Flags for websocket activation policies. More...

## Functions

const char * | opcode_to_string (opcode_t opcode)
| Helper sunction to get method string name.
bool | is_valid_opcode (opcode_t opcode)
std::string | status_code_to_bin (status_code_t code)
status_code_t | status_code_from_bin (string_view_t data)
template<typename Traits , typename WS_Message_Handler >
ws_handle_t | upgrade (generic_request_type_from_traits_t< Traits > &req, activation_t activation_flag, http_header_fields_t upgrade_response_header_fields, WS_Message_Handler ws_message_handler)
| Upgrade http-connection of a current request to a websocket connection.
template<typename Traits , typename WS_Message_Handler >
auto | upgrade (generic_request_type_from_traits_t< Traits > &req, activation_t activation_flag, std::string sec_websocket_accept_field_value, WS_Message_Handler ws_message_handler)
template<typename Traits , typename WS_Message_Handler >
auto | upgrade (generic_request_type_from_traits_t< Traits > &req, activation_t activation_flag, std::string sec_websocket_accept_field_value, std::string sec_websocket_protocol_field_value, WS_Message_Handler ws_message_handler)
template<typename Traits , typename WS_Message_Handler >
auto | upgrade (generic_request_type_from_traits_t< Traits > &req, activation_t activation_flag, WS_Message_Handler ws_message_handler)

## Variables

constexpr final_frame_flag_t | final_frame = final_frame_flag_t::final_frame
constexpr final_frame_flag_t | not_final_frame = final_frame_flag_t::not_final_frame

## Typedef Documentation

## byte_t

using restinio::websocket::basic::byte_t = typedef unsigned char

Alias for byte.

Definition at line 31 of file ws_parser.hpp.

## default_message_handler_t

using restinio::websocket::basic::default_message_handler_t = typedef std::function< void ( message_handle_t ) >

Definition at line 233 of file message.hpp.

## message_handle_t

using restinio::websocket::basic::message_handle_t = typedef std::shared_ptr< message_t >

Request handler, that is the type for calling request handlers.

Definition at line 227 of file message.hpp.

## raw_data_t

using restinio::websocket::basic::raw_data_t = typedef std::string

Bytes buffer.

Definition at line 34 of file ws_parser.hpp.

## ws_handle_t

typedef std::shared_ptr< ws_t > restinio::websocket::basic::ws_handle_t

Alias for ws_t handle.

Definition at line 27 of file ws_connection_base.hpp.

## Enumeration Type Documentation

## activation_t

enum class restinio::websocket::basic::activation_t

strong

Flags for websocket activation policies.

Enumerator
immediate | Activate immediately after upgrade operation.
delayed | User will initiate activation later.

Definition at line 198 of file websocket.hpp.

## final_frame_flag_t

enum class restinio::websocket::basic::final_frame_flag_t : std::uint8_t

strong

WS frame (message) "final"/"not final" flag.

Enumerator
final_frame |
not_final_frame |

Definition at line 133 of file message.hpp.

## opcode_t

enum class restinio::websocket::basic::opcode_t : std::uint8_t

strong

Enumerator
RESTINIO_WEBSOCKET_OPCODES_GEN |
unknown_frame |

Definition at line 36 of file message.hpp.

## status_code_t

enum class restinio::websocket::basic::status_code_t : std::uint16_t

strong

Enumerator
normal_closure |
going_away |
protocol_error |
cant_accept_data |
no_status_provided |
connection_lost |
invalid_message_data |
policy_violation |
too_big_message |
more_extensions_expected |
unexpected_condition |

Definition at line 85 of file message.hpp.

## Function Documentation

## is_valid_opcode()

bool restinio::websocket::basic::is_valid_opcode | ( | opcode_t | opcode | ) |

inline

Definition at line 64 of file message.hpp.

## opcode_to_string()

const char * restinio::websocket::basic::opcode_to_string | ( | opcode_t | opcode | ) |

inline

Helper sunction to get method string name.

Definition at line 46 of file message.hpp.

## status_code_from_bin()

status_code_t restinio::websocket::basic::status_code_from_bin | ( | string_view_t | data | ) |

inline

Definition at line 112 of file message.hpp.

## status_code_to_bin()

std::string restinio::websocket::basic::status_code_to_bin | ( | status_code_t | code | ) |

inline

Definition at line 101 of file message.hpp.

## upgrade() [1/4]

template<typename Traits , typename WS_Message_Handler >

ws_handle_t restinio::websocket::basic::upgrade | ( | generic_request_type_from_traits_t< Traits > & | req,
|  | activation_t | activation_flag,
|  | http_header_fields_t | upgrade_response_header_fields,
|  | WS_Message_Handler | ws_message_handler
| ) |  |

Upgrade http-connection of a current request to a websocket connection.

Check if mandatory field is available.

Parameters

  req | Upgrade request.
  activation_flag | Activation policy.
  upgrade_response_header_fields | Response header fields.
  ws_message_handler | Message handler.

Definition at line 215 of file websocket.hpp.

## upgrade() [2/4]

template<typename Traits , typename WS_Message_Handler >

auto restinio::websocket::basic::upgrade | ( | generic_request_type_from_traits_t< Traits > & | req,
|  | activation_t | activation_flag,
|  | std::string | sec_websocket_accept_field_value,
|  | std::string | sec_websocket_protocol_field_value,
|  | WS_Message_Handler | ws_message_handler
| ) |  |

Definition at line 319 of file websocket.hpp.

## upgrade() [3/4]

template<typename Traits , typename WS_Message_Handler >

auto restinio::websocket::basic::upgrade | ( | generic_request_type_from_traits_t< Traits > & | req,
|  | activation_t | activation_flag,
|  | std::string | sec_websocket_accept_field_value,
|  | WS_Message_Handler | ws_message_handler
| ) |  |

Definition at line 296 of file websocket.hpp.

## upgrade() [4/4]

template<typename Traits , typename WS_Message_Handler >

auto restinio::websocket::basic::upgrade | ( | generic_request_type_from_traits_t< Traits > & | req,
|  | activation_t | activation_flag,
|  | WS_Message_Handler | ws_message_handler
| ) |  |

Definition at line 347 of file websocket.hpp.

## Variable Documentation

## final_frame

constexpr final_frame_flag_t restinio::websocket::basic::final_frame = final_frame_flag_t::final_frame

constexpr

Definition at line 135 of file message.hpp.

## not_final_frame

constexpr final_frame_flag_t restinio::websocket::basic::not_final_frame = final_frame_flag_t::not_final_frame

constexpr

Definition at line 136 of file message.hpp.