Füge Unterstützung für Würfelspiele hinzu und verbessere Debugging-Optionen

- Implementiere neue Funktionen in der ChatRoom-Klasse für das Starten, Rollen und Beenden von Würfelspielen.
- Füge eine Option zur Aktivierung von Debug-Logging in CMake hinzu, um die Entwicklung zu erleichtern.
- Aktualisiere die ChatUser-Klasse, um die Interaktion mit dem Würfelspiel zu ermöglichen.
- Verbessere die Socket-Verwaltung im Server, um WebSocket-Verbindungen zu unterstützen und die Handhabung von Anfragen zu optimieren.
- Aktualisiere die Konfiguration, um die neue Funktionalität zu unterstützen und die Benutzererfahrung zu verbessern.
This commit is contained in:
Torsten Schulz (local)
2025-08-16 22:43:08 +02:00
parent 864d86aa09
commit 7338f1a740
15 changed files with 1556 additions and 135 deletions

View File

@@ -4,18 +4,32 @@
#include <json/json.h>
namespace Yc {
namespace Lib {
namespace Lib {
class Base {
protected:
std::string getJsonString(Json::Value json);
void send(int socket, std::string out);
void send(int socket, Json::Value out);
std::string readSocket(int socket);
Json::Value getJsonTree(std::string msg);
};
class Base {
public:
static std::string getJsonString(const Json::Value& json);
static Json::Value getJsonTree(const std::string& msg);
} // namespace Lib
// Neue öffentliche Helper zum Entfernen aller "token"-Felder
static void sanitizeTokens(Json::Value& v);
static void sanitizeTokensInString(std::string& s);
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