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.
This commit is contained in:
committed by
Torsten (PC)
parent
5ac8e9b484
commit
dafdbf0a84
@@ -549,7 +549,7 @@ bool WebSocketServer::isMainAdmin(const std::string &hashedUserId) {
|
|||||||
return count > 0;
|
return count > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
json WebSocketServer::getActiveConnections() {
|
nlohmann::json WebSocketServer::getActiveConnections() {
|
||||||
json result = json::array();
|
json result = json::array();
|
||||||
|
|
||||||
std::shared_lock<std::shared_mutex> lock(connectionsMutex);
|
std::shared_lock<std::shared_mutex> lock(connectionsMutex);
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ private:
|
|||||||
void handleBrokerMessage(const std::string &message);
|
void handleBrokerMessage(const std::string &message);
|
||||||
std::string getUserIdFromFalukantUserId(int falukantUserId);
|
std::string getUserIdFromFalukantUserId(int falukantUserId);
|
||||||
bool isMainAdmin(const std::string &hashedUserId);
|
bool isMainAdmin(const std::string &hashedUserId);
|
||||||
json getActiveConnections();
|
nlohmann::json getActiveConnections();
|
||||||
void sendMessageToConnection(struct lws *wsi, const std::string &message);
|
void sendMessageToConnection(struct lws *wsi, const std::string &message);
|
||||||
void addConnection(const std::string &userId, struct lws *wsi);
|
void addConnection(const std::string &userId, struct lws *wsi);
|
||||||
void removeConnection(const std::string &userId, struct lws *wsi);
|
void removeConnection(const std::string &userId, struct lws *wsi);
|
||||||
|
|||||||
Reference in New Issue
Block a user