From 789e5555ab4c44a1ae779eccf6ccf8340602cf22 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Thu, 26 Jan 2023 20:46:30 +0100 Subject: Websockets: Notify other clients of changes --- whiteboard.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'whiteboard.h') diff --git a/whiteboard.h b/whiteboard.h index d645115..e39b94e 100644 --- a/whiteboard.h +++ b/whiteboard.h @@ -8,6 +8,7 @@ #include #include "config.h" +#include "connectionregistry.h" #include "storage.h" class Whiteboard @@ -20,8 +21,13 @@ private: std::unique_ptr m_config; std::unique_ptr m_storage; std::mutex m_storage_mutex; + std::mutex m_websocket_mutex; + + ConnectionRegistry m_registry; - std::string handle_request(const std::string& request); + using connection = std::shared_ptr>; + std::string handle_request(connection& c, const std::string& request); + void notify_other_connections(connection& c, const std::string& id); // notify all other id-related connections about changes void do_session(boost::asio::ip::tcp::socket socket); void storage_cleanup(); }; -- cgit v1.2.3