ClientConfigSubscriber added

This commit is contained in:
Nemoumbra committed 2023-05-31 19:17:43 +03:00
1 parent 24ebd76992
commit 311687a673
10 files changed
+173 -7

No files matched your search

+14 -5
View File
@@ -62,6 +62,7 @@
#include "Core/Debugger/WebSocket/MemorySubscriber.h"
#include "Core/Debugger/WebSocket/ReplaySubscriber.h"
#include "Core/Debugger/WebSocket/SteppingSubscriber.h"
#include "Core/Debugger/WebSocket/ClientConfigSubscriber.h"
typedef DebuggerSubscriber *(*SubscriberInit)(DebuggerEventHandlerMap &map);
static const std::vector<SubscriberInit> subscribers({
@@ -78,6 +79,7 @@ static const std::vector<SubscriberInit> subscribers({
&WebSocketMemoryInit,
&WebSocketReplayInit,
&WebSocketSteppingInit,
&WebSocketClientConfigInit,
});
// To handle webserver restart, keep track of how many running.
@@ -139,6 +141,7 @@ void HandleDebuggerRequest(const http::Request &request) {
SetupDebuggerLock();
WebSocketClientInfo client_info;
auto& allowed_config = client_info.allowed;
GameBroadcaster game;
LogBroadcaster logger;
@@ -187,11 +190,17 @@ void HandleDebuggerRequest(const http::Request &request) {
while (ws->Process(highActivity ? 1.0f / 1000.0f : 1.0f / 60.0f)) {
std::lock_guard<std::mutex> guard(lifecycleLock);
// These send events that aren't just responses to requests.
logger.Broadcast(ws);
game.Broadcast(ws);
stepping.Broadcast(ws);
input.Broadcast(ws);
// These send events that aren't just responses to requests
// The client can explicitly ask not to be notified about some events
if (allowed_config.at("logger"))
logger.Broadcast(ws);
if (allowed_config.at("game"))
game.Broadcast(ws);
if (allowed_config.at("stepping"))
stepping.Broadcast(ws);
if (allowed_config.at("input"))
input.Broadcast(ws);
for (size_t i = 0; i < subscribers.size(); ++i) {
if (subscriberData[i]) {