Füge Unterstützung für SSL/TLS in den WebSocket-Server hinzu. Aktualisiere die Konfigurationsdatei, um SSL-Optionen zu ermöglichen, und passe die WebSocketServer-Klasse an, um Zertifikat- und Schlüsselpfade zu akzeptieren. Verbessere die Serverstartlogik, um SSL korrekt zu initialisieren und entsprechende Meldungen auszugeben.

This commit is contained in:
Torsten Schulz (local)
2025-09-03 14:50:07 +02:00
committed by Torsten (PC)
parent 92e17a9f43
commit 8212e906a3
5 changed files with 143 additions and 6 deletions

View File

@@ -25,7 +25,8 @@ class Worker; // forward
class WebSocketServer {
public:
WebSocketServer(int port, ConnectionPool &pool, MessageBroker &broker);
WebSocketServer(int port, ConnectionPool &pool, MessageBroker &broker,
bool useSSL = false, const std::string& certPath = "", const std::string& keyPath = "");
~WebSocketServer();
void run();
@@ -46,6 +47,9 @@ private:
int port;
ConnectionPool &pool;
MessageBroker &broker;
bool useSSL;
std::string certPath;
std::string keyPath;
std::atomic<bool> running{false};
struct lws_context *context = nullptr;