16 class messaging_ws_client;
59 std::string_view client_id,
60 std::chrono::milliseconds ping_interval = std::chrono::seconds(30));
84 auto set_path(std::string_view path) -> void;
90 [[nodiscard]]
auto is_running() const ->
bool override;
97 [[nodiscard]] auto
start(std::string_view host, uint16_t port) ->
VoidResult override;
99 [[nodiscard]] auto
send(std::vector<uint8_t>&& data) ->
VoidResult override;
100 [[nodiscard]] auto
is_connected() const ->
bool override;
102 auto
set_observer(std::shared_ptr<interfaces::connection_observer> observer) ->
void override;
118 std::shared_ptr<core::messaging_ws_client>
client_;
121 std::shared_ptr<interfaces::connection_observer>
observer_;
Unified interface for all protocol client implementations.
std::function< void(const std::vector< uint8_t > &)> receive_callback_t
Callback type for received data.
std::function< void()> connected_callback_t
Callback type for connection established.
std::function< void(std::error_code)> error_callback_t
Callback type for errors.
std::function< void()> disconnected_callback_t
Callback type for disconnection.
Adapter that wraps messaging_ws_client to implement i_protocol_client.
ws_client_adapter(ws_client_adapter &&)=delete
auto stop() -> VoidResult override
Stops the client and closes the connection.
auto set_path(std::string_view path) -> void
Sets the WebSocket path for connection.
ws_client_adapter & operator=(const ws_client_adapter &)=delete
receive_callback_t receive_callback_
auto set_disconnected_callback(disconnected_callback_t callback) -> void override
Sets the callback for disconnection.
auto wait_for_stop() -> void override
Blocks until the component has stopped.
std::shared_ptr< core::messaging_ws_client > client_
std::chrono::milliseconds ping_interval_
auto setup_internal_callbacks() -> void
Sets up internal callbacks to bridge WebSocket callbacks to i_protocol_client callbacks.
connected_callback_t connected_callback_
ws_client_adapter & operator=(ws_client_adapter &&)=delete
auto set_receive_callback(receive_callback_t callback) -> void override
Sets the callback for received data.
~ws_client_adapter() override
Destructor ensures proper cleanup.
disconnected_callback_t disconnected_callback_
auto start(std::string_view host, uint16_t port) -> VoidResult override
Starts the client and connects to the specified server.
error_callback_t error_callback_
auto is_running() const -> bool override
Checks if the component is currently running.
auto is_connected() const -> bool override
Checks if the client is connected to the server.
std::shared_ptr< interfaces::connection_observer > observer_
ws_client_adapter(const ws_client_adapter &)=delete
auto set_observer(std::shared_ptr< interfaces::connection_observer > observer) -> void override
Sets the connection observer for unified event handling.
std::mutex callbacks_mutex_
auto set_connected_callback(connected_callback_t callback) -> void override
Sets the callback for connection established.
auto set_error_callback(error_callback_t callback) -> void override
Sets the callback for errors.
ws_client_adapter(std::string_view client_id, std::chrono::milliseconds ping_interval=std::chrono::seconds(30))
Constructs an adapter with a unique client ID.
Protocol-specific client interface extending i_client.