Refactor WebSocket server message handling to include user data
- Update sendMessageToConnection to accept user data, enhancing message delivery accuracy. - Improve error handling in WebSocket callbacks by adding user data checks to prevent null pointer exceptions. - Enhance logging for error responses to provide clearer insights into message handling issues.
This commit is contained in:
committed by
Torsten (PC)
parent
88f6686809
commit
0c36c4a4e5
@@ -52,6 +52,7 @@ private:
|
||||
bool isMainAdmin(const std::string &hashedUserId);
|
||||
nlohmann::json getActiveConnections();
|
||||
void sendMessageToConnection(struct lws *wsi, const std::string &message);
|
||||
void sendMessageToConnection(struct lws *wsi, WebSocketUserData *ud, const std::string &message);
|
||||
void addConnection(const std::string &userId, struct lws *wsi);
|
||||
void removeConnection(const std::string &userId, struct lws *wsi);
|
||||
void removeConnectionByWsi(struct lws *wsi); // Entfernt Verbindung aus allen Einträgen (Fallback)
|
||||
|
||||
Reference in New Issue
Block a user