Network System 0.1.1
High-performance modular networking library for scalable client-server applications
Loading...
Searching...
No Matches
kcenon::network::interfaces::i_websocket_session Interface Referenceabstract

Interface for a WebSocket session on the server side. More...

#include <i_websocket_server.h>

Inheritance diagram for kcenon::network::interfaces::i_websocket_session:
Inheritance graph
Collaboration diagram for kcenon::network::interfaces::i_websocket_session:
Collaboration graph

Public Member Functions

virtual auto send_text (std::string &&message) -> VoidResult=0
 Sends a text message to the client.
 
virtual auto send_binary (std::vector< uint8_t > &&data) -> VoidResult=0
 Sends a binary message to the client.
 
virtual auto close (uint16_t code, std::string_view reason="") -> void=0
 Closes the WebSocket connection gracefully.
 
virtual auto path () const -> std::string_view=0
 Gets the requested path from the handshake.
 
- Public Member Functions inherited from kcenon::network::interfaces::i_session
virtual ~i_session ()=default
 Virtual destructor for proper cleanup.
 
 i_session (const i_session &)=delete
 
i_sessionoperator= (const i_session &)=delete
 
 i_session (i_session &&)=delete
 
i_sessionoperator= (i_session &&)=delete
 
virtual auto id () const -> std::string_view=0
 Gets the unique identifier for this session.
 
virtual auto is_connected () const -> bool=0
 Checks if the session is currently connected.
 
virtual auto send (std::vector< uint8_t > &&data) -> VoidResult=0
 Sends data to the client.
 
virtual auto close () -> void=0
 Closes the session.
 

Additional Inherited Members

- Protected Member Functions inherited from kcenon::network::interfaces::i_session
 i_session ()=default
 Default constructor (only for derived classes)
 

Detailed Description

Interface for a WebSocket session on the server side.

This interface extends i_session with WebSocket-specific operations such as sending text/binary messages and closing with status codes.

Definition at line 30 of file i_websocket_server.h.

Member Function Documentation

◆ close()

virtual auto kcenon::network::interfaces::i_websocket_session::close ( uint16_t code,
std::string_view reason = "" ) -> void
pure virtual

Closes the WebSocket connection gracefully.

Parameters
codeThe close status code.
reasonOptional human-readable reason.

Implemented in kcenon::network::core::ws_connection.

◆ path()

virtual auto kcenon::network::interfaces::i_websocket_session::path ( ) const -> std::string_view
nodiscardpure virtual

Gets the requested path from the handshake.

Returns
The WebSocket path (e.g., "/ws").

Implemented in kcenon::network::core::ws_connection.

◆ send_binary()

virtual auto kcenon::network::interfaces::i_websocket_session::send_binary ( std::vector< uint8_t > && data) -> VoidResult
nodiscardpure virtual

Sends a binary message to the client.

Parameters
dataThe binary data to send.
Returns
VoidResult indicating success or failure.

Implemented in kcenon::network::core::ws_connection.

◆ send_text()

virtual auto kcenon::network::interfaces::i_websocket_session::send_text ( std::string && message) -> VoidResult
nodiscardpure virtual

Sends a text message to the client.

Parameters
messageThe text message to send.
Returns
VoidResult indicating success or failure.

Implemented in kcenon::network::core::ws_connection.


The documentation for this interface was generated from the following file: