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

WebSocket framing layer built on top of tcp_socket. More...

#include <websocket_socket.h>

Inheritance diagram for kcenon::network::internal::websocket_socket:
Inheritance graph
Collaboration diagram for kcenon::network::internal::websocket_socket:
Collaboration graph

Public Member Functions

 websocket_socket (std::shared_ptr< tcp_socket > socket, bool is_client)
 Constructs a websocket_socket wrapping an existing tcp_socket.
 
 ~websocket_socket ()
 Destructor.
 
auto async_handshake (const std::string &host, const std::string &path, uint16_t port, std::function< void(std::error_code)> handler) -> void
 Performs WebSocket client handshake (RFC 6455 Section 4.1).
 
auto async_accept (std::function< void(std::error_code)> handler) -> void
 Accepts WebSocket server handshake (RFC 6455 Section 4.2).
 
auto start_read () -> void
 Starts reading WebSocket frames from the underlying socket.
 
auto async_send_text (std::string &&message, std::function< void(std::error_code, std::size_t)> handler) -> VoidResult
 Sends a text message (UTF-8 encoded).
 
auto async_send_binary (std::vector< uint8_t > &&data, std::function< void(std::error_code, std::size_t)> handler) -> VoidResult
 Sends a binary message.
 
auto async_send_ping (std::vector< uint8_t > payload, std::function< void(std::error_code)> handler) -> void
 Sends a ping control frame.
 
auto async_close (ws_close_code code, const std::string &reason, std::function< void(std::error_code)> handler) -> void
 Initiates the WebSocket closing handshake.
 
auto state () const -> ws_state
 Gets the current connection state.
 
auto is_open () const -> bool
 Checks if the connection is open and ready.
 
auto set_message_callback (std::function< void(const ws_message &)> callback) -> void
 Sets the callback for received messages.
 
auto set_ping_callback (std::function< void(const std::vector< uint8_t > &)> callback) -> void
 Sets the callback for received ping frames.
 
auto set_pong_callback (std::function< void(const std::vector< uint8_t > &)> callback) -> void
 Sets the callback for received pong frames.
 
auto set_close_callback (std::function< void(ws_close_code, const std::string &)> callback) -> void
 Sets the callback for received close frames.
 
auto set_error_callback (std::function< void(std::error_code)> callback) -> void
 Sets the callback for errors.
 

Private Member Functions

auto on_tcp_receive (std::span< const uint8_t > data) -> void
 Called by tcp_socket when data is received.
 
auto on_tcp_error (std::error_code ec) -> void
 Called by tcp_socket when an error occurs.
 
auto handle_protocol_message (const ws_message &msg) -> void
 Handles a decoded message from the protocol layer.
 
auto handle_protocol_ping (const std::vector< uint8_t > &payload) -> void
 Handles a ping frame from the protocol layer.
 
auto handle_protocol_pong (const std::vector< uint8_t > &payload) -> void
 Handles a pong frame from the protocol layer.
 
auto handle_protocol_close (ws_close_code code, const std::string &reason) -> void
 Handles a close frame from the protocol layer.
 

Private Attributes

std::shared_ptr< tcp_sockettcp_socket_
 
websocket_protocol protocol_
 
std::atomic< ws_statestate_ {ws_state::connecting}
 
std::mutex callback_mutex_
 
std::function< void(const ws_message &)> message_callback_
 
std::function< void(const std::vector< uint8_t > &)> ping_callback_
 
std::function< void(const std::vector< uint8_t > &)> pong_callback_
 
std::function< void(ws_close_code, const std::string &)> close_callback_
 
std::function< void(std::error_code)> error_callback_
 

Detailed Description

WebSocket framing layer built on top of tcp_socket.

This class wraps an existing tcp_socket and provides WebSocket protocol framing. The underlying tcp_socket handles all transport I/O operations, while websocket_socket handles:

  • WebSocket handshake (client and server)
  • Frame encoding/decoding via websocket_protocol
  • Message fragmentation and reassembly
  • Connection state management
  • Ping/pong keepalive
  • Close handshake

Design rationale:

Definition at line 59 of file websocket_socket.h.

Constructor & Destructor Documentation

◆ websocket_socket()

kcenon::network::internal::websocket_socket::websocket_socket ( std::shared_ptr< tcp_socket > socket,
bool is_client )

Constructs a websocket_socket wrapping an existing tcp_socket.

Parameters
socketThe underlying TCP socket (must be connected)
is_clientTrue if this is a client endpoint (applies masking)

Definition at line 16 of file websocket_socket.cpp.

18 : tcp_socket_(std::move(socket))
19 , protocol_(is_client)
20 {
21 // Set up WebSocket protocol callbacks
23 [this](const ws_message& msg) { handle_protocol_message(msg); });
24
25 protocol_.set_ping_callback([this](const std::vector<uint8_t>& payload)
26 {
27 // RFC 6455: Automatically respond to Ping with Pong
28 auto pong_frame = protocol_.create_pong(
29 std::vector<uint8_t>(payload));
30 tcp_socket_->async_send(
31 std::move(pong_frame),
32 [](std::error_code, std::size_t) {});
33
34 handle_protocol_ping(payload);
35 });
36
37 protocol_.set_pong_callback([this](const std::vector<uint8_t>& payload)
38 { handle_protocol_pong(payload); });
39
40 protocol_.set_close_callback([this](ws_close_code code, const std::string& reason)
41 { handle_protocol_close(code, reason); });
42
43 // Set up TCP socket callbacks to feed data into protocol layer
44 // Use zero-copy span callback to avoid per-read vector allocation
45 tcp_socket_->set_receive_callback_view(
46 [this](std::span<const uint8_t> data) { on_tcp_receive(data); });
47
48 tcp_socket_->set_error_callback(
49 [this](std::error_code ec) { on_tcp_error(ec); });
50 }
auto set_message_callback(std::function< void(const ws_message &)> callback) -> void
Sets the callback for data messages.
auto create_pong(std::vector< uint8_t > &&payload={}) -> std::vector< uint8_t >
Creates a pong control frame.
auto set_close_callback(std::function< void(ws_close_code, const std::string &)> callback) -> void
Sets the callback for close frames.
auto set_ping_callback(std::function< void(const std::vector< uint8_t > &)> callback) -> void
Sets the callback for ping frames.
auto set_pong_callback(std::function< void(const std::vector< uint8_t > &)> callback) -> void
Sets the callback for pong frames.
auto handle_protocol_ping(const std::vector< uint8_t > &payload) -> void
Handles a ping frame from the protocol layer.
std::shared_ptr< tcp_socket > tcp_socket_
auto handle_protocol_message(const ws_message &msg) -> void
Handles a decoded message from the protocol layer.
auto on_tcp_receive(std::span< const uint8_t > data) -> void
Called by tcp_socket when data is received.
auto handle_protocol_close(ws_close_code code, const std::string &reason) -> void
Handles a close frame from the protocol layer.
auto on_tcp_error(std::error_code ec) -> void
Called by tcp_socket when an error occurs.
auto handle_protocol_pong(const std::vector< uint8_t > &payload) -> void
Handles a pong frame from the protocol layer.
ws_close_code
WebSocket close status codes (RFC 6455 Section 7.4).

References kcenon::network::internal::websocket_protocol::create_pong(), handle_protocol_close(), handle_protocol_message(), handle_protocol_ping(), handle_protocol_pong(), on_tcp_error(), on_tcp_receive(), protocol_, kcenon::network::internal::websocket_protocol::set_close_callback(), kcenon::network::internal::websocket_protocol::set_message_callback(), kcenon::network::internal::websocket_protocol::set_ping_callback(), kcenon::network::internal::websocket_protocol::set_pong_callback(), and tcp_socket_.

Here is the call graph for this function:

◆ ~websocket_socket()

kcenon::network::internal::websocket_socket::~websocket_socket ( )

Destructor.

Stops reading and cleans up resources.

Definition at line 52 of file websocket_socket.cpp.

53 {
54 // Cleanup resources if needed
55 }

Member Function Documentation

◆ async_accept()

auto kcenon::network::internal::websocket_socket::async_accept ( std::function< void(std::error_code)> handler) -> void

Accepts WebSocket server handshake (RFC 6455 Section 4.2).

Reads the client's HTTP/1.1 Upgrade request and sends the acceptance response. The handler is called with success/failure status.

Parameters
handlerCallback invoked with handshake result

Definition at line 124 of file websocket_socket.cpp.

126 {
127 // Set up temporary callback to receive handshake request
128 // Use span callback for zero-copy during handshake
129 tcp_socket_->set_receive_callback_view(
130 [this, handler](std::span<const uint8_t> data)
131 {
132 // Convert request to string
133 std::string request(data.begin(), data.end());
134
135 // Parse client request
136 auto result = websocket_handshake::parse_client_request(request);
137
138 if (!result.success)
139 {
140 handler(std::make_error_code(std::errc::protocol_error));
141 return;
142 }
143
144 // Extract client key (headers are stored lowercase by parse_headers)
145 auto it = result.headers.find("sec-websocket-key");
146 if (it == result.headers.end())
147 {
148 handler(std::make_error_code(std::errc::protocol_error));
149 return;
150 }
151
152 std::string client_key = it->second;
153
154 // Generate server response
155 auto response = websocket_handshake::create_server_response(client_key);
156 std::vector<uint8_t> response_data(response.begin(), response.end());
157
158 // Send response
159 tcp_socket_->async_send(
160 std::move(response_data),
161 [this, handler](std::error_code ec, std::size_t)
162 {
163 if (ec)
164 {
165 handler(ec);
166 return;
167 }
168
169 // Handshake successful, update state
171
172 // Restore normal receive callback
173 tcp_socket_->set_receive_callback_view(
174 [this](std::span<const uint8_t> data)
175 { on_tcp_receive(data); });
176
177 handler(std::error_code{});
178 });
179 });
180
181 // Start reading request
182 tcp_socket_->start_read();
183 }
static auto create_server_response(const std::string &client_key) -> std::string
Creates a WebSocket handshake response (server-side).
static auto parse_client_request(const std::string &request) -> ws_handshake_result
Parses a WebSocket handshake request (server-side).
@ open
Connection established and ready.

References kcenon::network::internal::websocket_handshake::create_server_response(), kcenon::network::internal::open, and kcenon::network::internal::websocket_handshake::parse_client_request().

Here is the call graph for this function:

◆ async_close()

auto kcenon::network::internal::websocket_socket::async_close ( ws_close_code code,
const std::string & reason,
std::function< void(std::error_code)> handler ) -> void

Initiates the WebSocket closing handshake.

Sends a close frame with the specified status code and reason. The connection state transitions to closing.

Parameters
codeThe close status code (RFC 6455 Section 7.4)
reasonOptional human-readable reason (UTF-8, max ~123 bytes)
handlerCallback invoked when close frame is sent

Definition at line 249 of file websocket_socket.cpp.

252 {
253 // Update state to closing
255
256 // Encode close frame
257 auto frame_data = protocol_.create_close(code, std::string(reason));
258
259 // Send via underlying tcp_socket
260 tcp_socket_->async_send(std::move(frame_data),
261 [this, handler](std::error_code ec, std::size_t)
262 {
263 if (ec)
264 {
266 if (handler)
267 {
268 handler(ec);
269 }
270 return;
271 }
272
273 // Close handshake initiated successfully
274 if (handler)
275 {
276 handler(std::error_code{});
277 }
278 });
279 }
auto create_close(ws_close_code code, std::string &&reason="") -> std::vector< uint8_t >
Creates a close control frame.
@ closing
Close handshake initiated.

References kcenon::network::internal::closed, and kcenon::network::internal::closing.

◆ async_handshake()

auto kcenon::network::internal::websocket_socket::async_handshake ( const std::string & host,
const std::string & path,
uint16_t port,
std::function< void(std::error_code)> handler ) -> void

Performs WebSocket client handshake (RFC 6455 Section 4.1).

Sends an HTTP/1.1 Upgrade request and validates the server response. The handler is called with success/failure status.

Parameters
hostThe server hostname (for Host header)
pathThe request path (e.g., "/chat")
portThe server port (for Host header)
handlerCallback invoked with handshake result

Definition at line 57 of file websocket_socket.cpp.

61 {
62 // Generate client handshake request
63 auto handshake_request =
65
66 // Store the expected key for validation
67 auto key_start = handshake_request.find("Sec-WebSocket-Key: ");
68 std::string client_key;
69 if (key_start != std::string::npos)
70 {
71 key_start += 19; // Length of "Sec-WebSocket-Key: "
72 auto key_end = handshake_request.find("\r\n", key_start);
73 client_key = handshake_request.substr(key_start, key_end - key_start);
74 }
75
76 // Send handshake request
77 std::vector<uint8_t> request_data(handshake_request.begin(),
78 handshake_request.end());
79
80 tcp_socket_->async_send(
81 std::move(request_data),
82 [this, client_key, handler](std::error_code ec, std::size_t)
83 {
84 if (ec)
85 {
86 handler(ec);
87 return;
88 }
89
90 // Set up temporary callback to receive handshake response
91 // Use span callback for zero-copy during handshake
92 tcp_socket_->set_receive_callback_view(
93 [this, client_key, handler](std::span<const uint8_t> data)
94 {
95 // Convert response to string
96 std::string response(data.begin(), data.end());
97
98 // Validate server response
100 response, client_key);
101
102 if (!result.success)
103 {
104 handler(std::make_error_code(std::errc::protocol_error));
105 return;
106 }
107
108 // Handshake successful, update state
110
111 // Restore normal receive callback
112 tcp_socket_->set_receive_callback_view(
113 [this](std::span<const uint8_t> data)
114 { on_tcp_receive(data); });
115
116 handler(std::error_code{});
117 });
118
119 // Start reading response
120 tcp_socket_->start_read();
121 });
122 }
static auto create_client_handshake(std::string_view host, std::string_view path, uint16_t port, const std::map< std::string, std::string > &extra_headers={}) -> std::string
Creates a WebSocket handshake request (client-side).
static auto validate_server_response(const std::string &response, const std::string &expected_key) -> ws_handshake_result
Validates a WebSocket handshake response (client-side).

References kcenon::network::internal::websocket_handshake::create_client_handshake(), kcenon::network::internal::open, and kcenon::network::internal::websocket_handshake::validate_server_response().

Here is the call graph for this function:

◆ async_send_binary()

auto kcenon::network::internal::websocket_socket::async_send_binary ( std::vector< uint8_t > && data,
std::function< void(std::error_code, std::size_t)> handler ) -> VoidResult

Sends a binary message.

Uses move semantics for zero-copy operation. The data is encoded as a WebSocket binary frame.

Parameters
dataThe binary data to send
handlerCallback invoked with send result
Returns
VoidResult indicating success

Definition at line 212 of file websocket_socket.cpp.

215 {
216 if (state_ != ws_state::open)
217 {
219 "WebSocket connection not open");
220 }
221
222 // Encode binary message into WebSocket frame
223 auto frame_data = protocol_.create_binary_message(std::move(data));
224
225 // Send via underlying tcp_socket
226 tcp_socket_->async_send(std::move(frame_data), std::move(handler));
227
228 return ok();
229 }
auto create_binary_message(std::vector< uint8_t > &&data) -> std::vector< uint8_t >
Creates a binary message frame.
VoidResult error_void(int code, const std::string &message, const std::string &source="network_system", const std::string &details="")
VoidResult ok()

References kcenon::network::error_codes::network_system::connection_closed, kcenon::network::error_void(), kcenon::network::ok(), and kcenon::network::internal::open.

Here is the call graph for this function:

◆ async_send_ping()

auto kcenon::network::internal::websocket_socket::async_send_ping ( std::vector< uint8_t > payload,
std::function< void(std::error_code)> handler ) -> void

Sends a ping control frame.

Ping frames are used to check connection liveness. The peer should respond with a pong frame.

Parameters
payloadOptional payload data (max 125 bytes)
handlerCallback invoked with send result

Definition at line 231 of file websocket_socket.cpp.

234 {
235 // Encode ping frame
236 auto frame_data = protocol_.create_ping(std::move(payload));
237
238 // Send via underlying tcp_socket
239 tcp_socket_->async_send(std::move(frame_data),
240 [handler](std::error_code ec, std::size_t)
241 {
242 if (handler)
243 {
244 handler(ec);
245 }
246 });
247 }
auto create_ping(std::vector< uint8_t > &&payload={}) -> std::vector< uint8_t >
Creates a ping control frame.

◆ async_send_text()

auto kcenon::network::internal::websocket_socket::async_send_text ( std::string && message,
std::function< void(std::error_code, std::size_t)> handler ) -> VoidResult

Sends a text message (UTF-8 encoded).

Uses move semantics for zero-copy operation. The message is validated for UTF-8 encoding and encoded as a WebSocket text frame.

Parameters
messageThe text message to send
handlerCallback invoked with send result
Returns
VoidResult indicating validation success

Definition at line 187 of file websocket_socket.cpp.

190 {
191 if (state_ != ws_state::open)
192 {
194 "WebSocket connection not open");
195 }
196
197 // Encode text message into WebSocket frame
198 auto frame_data = protocol_.create_text_message(std::move(message));
199
200 if (frame_data.empty())
201 {
203 "Invalid UTF-8 in text message");
204 }
205
206 // Send via underlying tcp_socket
207 tcp_socket_->async_send(std::move(frame_data), std::move(handler));
208
209 return ok();
210 }
auto create_text_message(std::string &&text) -> std::vector< uint8_t >
Creates a text message frame.

References kcenon::network::error_codes::network_system::connection_closed, kcenon::network::error_void(), kcenon::network::error_codes::common_errors::invalid_argument, kcenon::network::message, kcenon::network::ok(), and kcenon::network::internal::open.

Here is the call graph for this function:

◆ handle_protocol_close()

auto kcenon::network::internal::websocket_socket::handle_protocol_close ( ws_close_code code,
const std::string & reason ) -> void
private

Handles a close frame from the protocol layer.

Updates connection state and invokes the close callback.

Parameters
codeThe close status code
reasonThe close reason string

Definition at line 371 of file websocket_socket.cpp.

373 {
374 // Update state to closed
376
377 std::lock_guard<std::mutex> lock(callback_mutex_);
378 if (close_callback_)
379 {
380 close_callback_(code, reason);
381 }
382 }
std::function< void(ws_close_code, const std::string &)> close_callback_

References kcenon::network::internal::closed.

Referenced by websocket_socket().

Here is the caller graph for this function:

◆ handle_protocol_message()

auto kcenon::network::internal::websocket_socket::handle_protocol_message ( const ws_message & msg) -> void
private

Handles a decoded message from the protocol layer.

Invokes the message callback.

Parameters
msgThe decoded message

Definition at line 342 of file websocket_socket.cpp.

343 {
344 std::lock_guard<std::mutex> lock(callback_mutex_);
346 {
348 }
349 }
std::function< void(const ws_message &)> message_callback_

Referenced by websocket_socket().

Here is the caller graph for this function:

◆ handle_protocol_ping()

auto kcenon::network::internal::websocket_socket::handle_protocol_ping ( const std::vector< uint8_t > & payload) -> void
private

Handles a ping frame from the protocol layer.

Invokes the ping callback (application may send pong).

Parameters
payloadThe ping payload

Definition at line 351 of file websocket_socket.cpp.

353 {
354 std::lock_guard<std::mutex> lock(callback_mutex_);
355 if (ping_callback_)
356 {
357 ping_callback_(payload);
358 }
359 }
std::function< void(const std::vector< uint8_t > &)> ping_callback_

Referenced by websocket_socket().

Here is the caller graph for this function:

◆ handle_protocol_pong()

auto kcenon::network::internal::websocket_socket::handle_protocol_pong ( const std::vector< uint8_t > & payload) -> void
private

Handles a pong frame from the protocol layer.

Invokes the pong callback.

Parameters
payloadThe pong payload

Definition at line 361 of file websocket_socket.cpp.

363 {
364 std::lock_guard<std::mutex> lock(callback_mutex_);
365 if (pong_callback_)
366 {
367 pong_callback_(payload);
368 }
369 }
std::function< void(const std::vector< uint8_t > &)> pong_callback_

Referenced by websocket_socket().

Here is the caller graph for this function:

◆ is_open()

auto kcenon::network::internal::websocket_socket::is_open ( ) const -> bool

Checks if the connection is open and ready.

Returns
True if state is ws_state::open

Definition at line 283 of file websocket_socket.cpp.

284 {
285 return state_.load() == ws_state::open;
286 }

References kcenon::network::internal::open, and state_.

◆ on_tcp_error()

auto kcenon::network::internal::websocket_socket::on_tcp_error ( std::error_code ec) -> void
private

Called by tcp_socket when an error occurs.

Propagates the error to the application.

Parameters
ecThe error code

Definition at line 329 of file websocket_socket.cpp.

330 {
331 // Update state to closed
333
334 // Propagate error to application
335 std::lock_guard<std::mutex> lock(callback_mutex_);
336 if (error_callback_)
337 {
338 error_callback_(ec);
339 }
340 }
std::function< void(std::error_code)> error_callback_

References kcenon::network::internal::closed.

Referenced by websocket_socket().

Here is the caller graph for this function:

◆ on_tcp_receive()

auto kcenon::network::internal::websocket_socket::on_tcp_receive ( std::span< const uint8_t > data) -> void
private

Called by tcp_socket when data is received.

Feeds the data into the WebSocket protocol decoder. Uses zero-copy span view from tcp_socket's read buffer.

Parameters
dataThe received raw bytes as a view

Definition at line 323 of file websocket_socket.cpp.

324 {
325 // Feed raw TCP data into WebSocket protocol decoder (zero-copy view)
327 }
auto process_data(std::span< const uint8_t > data) -> void
Processes incoming WebSocket data.

Referenced by websocket_socket().

Here is the caller graph for this function:

◆ set_close_callback()

auto kcenon::network::internal::websocket_socket::set_close_callback ( std::function< void(ws_close_code, const std::string &)> callback) -> void

Sets the callback for received close frames.

This callback is invoked when a close frame is received. The application should respond with a close frame if it hasn't already.

Parameters
callbackThe callback function

Definition at line 309 of file websocket_socket.cpp.

311 {
312 std::lock_guard<std::mutex> lock(callback_mutex_);
313 close_callback_ = std::move(callback);
314 }

◆ set_error_callback()

auto kcenon::network::internal::websocket_socket::set_error_callback ( std::function< void(std::error_code)> callback) -> void

Sets the callback for errors.

This callback is invoked when an error occurs on the underlying socket.

Parameters
callbackThe callback function

Definition at line 316 of file websocket_socket.cpp.

318 {
319 std::lock_guard<std::mutex> lock(callback_mutex_);
320 error_callback_ = std::move(callback);
321 }

◆ set_message_callback()

auto kcenon::network::internal::websocket_socket::set_message_callback ( std::function< void(const ws_message &)> callback) -> void

Sets the callback for received messages.

This callback is invoked when a complete text or binary message has been received and reassembled.

Parameters
callbackThe callback function

Definition at line 288 of file websocket_socket.cpp.

290 {
291 std::lock_guard<std::mutex> lock(callback_mutex_);
292 message_callback_ = std::move(callback);
293 }

◆ set_ping_callback()

auto kcenon::network::internal::websocket_socket::set_ping_callback ( std::function< void(const std::vector< uint8_t > &)> callback) -> void

Sets the callback for received ping frames.

This callback is invoked when a ping frame is received. The application may choose to send a pong response.

Parameters
callbackThe callback function

Definition at line 295 of file websocket_socket.cpp.

297 {
298 std::lock_guard<std::mutex> lock(callback_mutex_);
299 ping_callback_ = std::move(callback);
300 }

◆ set_pong_callback()

auto kcenon::network::internal::websocket_socket::set_pong_callback ( std::function< void(const std::vector< uint8_t > &)> callback) -> void

Sets the callback for received pong frames.

This callback is invoked when a pong frame is received (typically in response to a ping).

Parameters
callbackThe callback function

Definition at line 302 of file websocket_socket.cpp.

304 {
305 std::lock_guard<std::mutex> lock(callback_mutex_);
306 pong_callback_ = std::move(callback);
307 }

◆ start_read()

auto kcenon::network::internal::websocket_socket::start_read ( ) -> void

Starts reading WebSocket frames from the underlying socket.

Must be called after successful handshake to begin receiving messages.

Definition at line 185 of file websocket_socket.cpp.

185{ tcp_socket_->start_read(); }

◆ state()

auto kcenon::network::internal::websocket_socket::state ( ) const -> ws_state

Gets the current connection state.

Returns
The current ws_state

Definition at line 281 of file websocket_socket.cpp.

281{ return state_.load(); }

References state_.

Member Data Documentation

◆ callback_mutex_

std::mutex kcenon::network::internal::websocket_socket::callback_mutex_
private

Definition at line 238 of file websocket_socket.h.

◆ close_callback_

std::function<void(ws_close_code, const std::string&)> kcenon::network::internal::websocket_socket::close_callback_
private

Definition at line 242 of file websocket_socket.h.

◆ error_callback_

std::function<void(std::error_code)> kcenon::network::internal::websocket_socket::error_callback_
private

Definition at line 243 of file websocket_socket.h.

◆ message_callback_

std::function<void(const ws_message&)> kcenon::network::internal::websocket_socket::message_callback_
private

Definition at line 239 of file websocket_socket.h.

◆ ping_callback_

std::function<void(const std::vector<uint8_t>&)> kcenon::network::internal::websocket_socket::ping_callback_
private

Definition at line 240 of file websocket_socket.h.

◆ pong_callback_

std::function<void(const std::vector<uint8_t>&)> kcenon::network::internal::websocket_socket::pong_callback_
private

Definition at line 241 of file websocket_socket.h.

◆ protocol_

websocket_protocol kcenon::network::internal::websocket_socket::protocol_
private

Definition at line 234 of file websocket_socket.h.

Referenced by websocket_socket().

◆ state_

std::atomic<ws_state> kcenon::network::internal::websocket_socket::state_ {ws_state::connecting}
private

Definition at line 235 of file websocket_socket.h.

Referenced by is_open(), and state().

◆ tcp_socket_

std::shared_ptr<tcp_socket> kcenon::network::internal::websocket_socket::tcp_socket_
private

Definition at line 231 of file websocket_socket.h.

Referenced by websocket_socket().


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