From dafdbf0a84e669e991125716e1948348427ccfb4 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Thu, 20 Nov 2025 16:19:45 +0100 Subject: [PATCH] Refactor WebSocket server to use nlohmann::json for active connections - Update the return type of getActiveConnections() in both websocket_server.cpp and websocket_server.h to nlohmann::json for consistency and clarity. - Ensure proper usage of the nlohmann::json library in the WebSocket server implementation. --- src/websocket_server.cpp | 2 +- src/websocket_server.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/websocket_server.cpp b/src/websocket_server.cpp index e276471..ff8aca7 100644 --- a/src/websocket_server.cpp +++ b/src/websocket_server.cpp @@ -549,7 +549,7 @@ bool WebSocketServer::isMainAdmin(const std::string &hashedUserId) { return count > 0; } -json WebSocketServer::getActiveConnections() { +nlohmann::json WebSocketServer::getActiveConnections() { json result = json::array(); std::shared_lock lock(connectionsMutex); diff --git a/src/websocket_server.h b/src/websocket_server.h index 651754a..6e076bf 100644 --- a/src/websocket_server.h +++ b/src/websocket_server.h @@ -50,7 +50,7 @@ private: void handleBrokerMessage(const std::string &message); std::string getUserIdFromFalukantUserId(int falukantUserId); bool isMainAdmin(const std::string &hashedUserId); - json getActiveConnections(); + nlohmann::json getActiveConnections(); void sendMessageToConnection(struct lws *wsi, const std::string &message); void addConnection(const std::string &userId, struct lws *wsi); void removeConnection(const std::string &userId, struct lws *wsi);