Network System 0.1.1
High-performance modular networking library for scalable client-server applications
Loading...
Searching...
No Matches
kcenon::network::internal::ws_message Struct Reference

Represents a complete WebSocket message. More...

#include <websocket_protocol.h>

Collaboration diagram for kcenon::network::internal::ws_message:
Collaboration graph

Public Member Functions

auto as_text () const -> std::string
 Converts message data to string (for text messages).
 
auto as_binary () const -> const std::vector< uint8_t > &
 Returns message data as binary (reference).
 

Public Attributes

ws_message_type type
 Message type.
 
std::vector< uint8_t > data
 Message payload.
 

Detailed Description

Represents a complete WebSocket message.

A message may consist of one or more frames that have been reassembled. Text messages are UTF-8 encoded.

Definition at line 36 of file websocket_protocol.h.

Member Function Documentation

◆ as_binary()

auto kcenon::network::internal::ws_message::as_binary ( ) const -> const std::vector<uint8_t>&

Returns message data as binary (reference).

Returns
Reference to the binary data

Definition at line 21 of file websocket_protocol.cpp.

22 {
23 return data;
24 }
std::vector< uint8_t > data
Message payload.

References data.

◆ as_text()

auto kcenon::network::internal::ws_message::as_text ( ) const -> std::string

Converts message data to string (for text messages).

Returns
String representation of the data

Definition at line 16 of file websocket_protocol.cpp.

17 {
18 return std::string(data.begin(), data.end());
19 }

References data.

Member Data Documentation

◆ data

std::vector<uint8_t> kcenon::network::internal::ws_message::data

Message payload.

Definition at line 39 of file websocket_protocol.h.

Referenced by as_binary(), as_text(), and kcenon::network::internal::websocket_protocol::handle_data_frame().

◆ type

ws_message_type kcenon::network::internal::ws_message::type

Message type.

Definition at line 38 of file websocket_protocol.h.

Referenced by kcenon::network::internal::websocket_protocol::handle_data_frame().


The documentation for this struct was generated from the following files: