#ifndef YC_LIB_BASE_H #define YC_LIB_BASE_H #include namespace Yc { namespace Lib { class Base { public: static std::string getJsonString(const Json::Value& json); static Json::Value getJsonTree(const std::string& msg); // Neue öffentliche Helper zum Entfernen aller "token"-Felder static void sanitizeTokens(Json::Value& v); static void sanitizeTokensInString(std::string& s); static std::string generateToken(); protected: void send(int socket, std::string out); void send(int socket, Json::Value out); std::string readSocket(int socket); // WebSocket helpers (server-side): read one text frame and send a text frame std::string readWebSocketMessage(int socket); void sendWebSocketMessage(int socket, const std::string& out); // WebSocket connection tracking and handshake helpers static void markWebSocket(int socket); static void unmarkWebSocket(int socket); static bool isWebSocket(int socket); static std::string webSocketAcceptKey(const std::string& clientKey); }; } // namespace Lib } // namespace Yc #endif // YC_LIB_BASE_H