19#include <system_error>
77 [[nodiscard]]
virtual auto start(std::string_view host, uint16_t port) ->
VoidResult = 0;
Observer interface for client connection events.
Base interface for client-side network components.
std::function< void()> connected_callback_t
Callback type for connection established.
virtual auto send(std::vector< uint8_t > &&data) -> VoidResult=0
Sends data to the connected server.
virtual auto set_error_callback(error_callback_t callback) -> void=0
Sets the callback for errors.
virtual auto set_disconnected_callback(disconnected_callback_t callback) -> void=0
Sets the callback for disconnection.
virtual auto is_connected() const -> bool=0
Checks if the client is connected to the server.
virtual auto stop() -> VoidResult=0
Stops the client and closes the connection.
virtual auto set_connected_callback(connected_callback_t callback) -> void=0
Sets the callback for connection established.
std::function< void(std::error_code)> error_callback_t
Callback type for errors.
virtual auto start(std::string_view host, uint16_t port) -> VoidResult=0
Starts the client and connects to the specified server.
virtual auto set_receive_callback(receive_callback_t callback) -> void=0
Sets the callback for received data.
std::function< void()> disconnected_callback_t
Callback type for disconnection.
std::function< void(const std::vector< uint8_t > &)> receive_callback_t
Callback type for received data.
virtual auto set_observer(std::shared_ptr< connection_observer > observer) -> void=0
Sets the connection observer for unified event handling.
Base interface for all network components.
Observer interface for connection state change notifications.
Base interface for all network components.
Public header for Result<T> error handling types.