2#ifndef _KURLYK_WEBSOCKET_MANAGER_HPP_INCLUDED
3#define _KURLYK_WEBSOCKET_MANAGER_HPP_INCLUDED
10#ifdef KURLYK_USE_SIMPLEWEB
35 if (
auto client_ptr = client_weak_ptr.lock()) {
36 client_ptr->process();
40 m_client_list.remove_if([](
const std::weak_ptr<IWebSocketClient>& client_weak_ptr) {
41 return client_weak_ptr.expired();
51 if (
auto client_ptr = client_weak_ptr.lock()) {
52 client_ptr->shutdown();
62 if (
auto client_ptr = client_weak_ptr.lock()) {
63 if (client_ptr->is_running())
return true;
72 std::shared_ptr<IWebSocketClient> client;
74# ifdef KURLYK_USE_EMSCRIPTEN
76# if __cplusplus >= 201402L
77 client = std::make_shared<EmscriptenWebSocketClientAdapter>();
83# ifdef KURLYK_USE_SIMPLEWEB
85# if __cplusplus >= 201402L
86 client = std::make_shared<SimpleWebSocketClientAdapter>();
Contains the definition of the BaseWebSocketClient class, which provides the base functionality for W...
Declares the SimpleWebSocketClientAdapter implementation for WebSocket communication using Simple-Web...
A WebSocket client implementation using the Emscripten API.
A WebSocket client adapter that leverages the Simple WebSocket Server library for managing WebSocket ...
WebSocketManager()=default
Private constructor to enforce singleton pattern.
static WebSocketManager & get_instance()
Get the singleton instance of WebSocketManager.
void shutdown() override
Shuts down all active WebSocket clients managed by this instance.
std::mutex m_client_list_mutex
Mutex for synchronizing access to the client list.
std::list< std::weak_ptr< IWebSocketClient > > m_client_list
List of WebSocket clients managed by the WebSocketManager.
virtual ~WebSocketManager()=default
Private destructor to enforce singleton pattern.
WebSocketManager(const WebSocketManager &)=delete
Deleted copy constructor to enforce the singleton pattern.
WebSocketManager & operator=(const WebSocketManager &)=delete
Deleted copy assignment operator to enforce the singleton pattern.
std::shared_ptr< IWebSocketClient > create_client()
Creates and returns a new WebSocket client instance based on the platform defined by compilation flag...
const bool is_loaded() const override
Checks if any WebSocket client is currently running.
void process() override
Processes all active WebSocket clients managed by this instance.
Interface for modules managed by NetworkWorker (e.g., HTTP, WebSocket).
Primary namespace for the Kurlyk library, encompassing initialization, request management,...