Project
Loading...
Searching...
No Matches
StatusWebSocketHandler.h
Go to the documentation of this file.
1// Copyright 2019-2026 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11#ifndef O2_FRAMEWORK_STATUSWEBSOCKETHANDLER_H_
12#define O2_FRAMEWORK_STATUSWEBSOCKETHANDLER_H_
13
14#include "HTTPParser.h"
15#include <map>
16#include <string>
17#include <unordered_set>
18#include <vector>
19#include <cstddef>
20
21namespace o2::framework
22{
23struct DriverServerContext;
24struct WSDPLHandler;
25
76 ~StatusWebSocketHandler() override;
77
79 void headers(std::map<std::string, std::string> const& headers) override;
81 void frame(char const* data, size_t s) override;
82 void beginChunk() override {}
83 void endChunk() override {}
84 void beginFragmentation() override {}
85 void endFragmentation() override {}
86 void control(char const* frame, size_t s) override {}
87
89 void sendSnapshot();
93 void sendUpdate(size_t deviceIndex);
96 void sendNewLogs(size_t deviceIndex);
97
98 private:
99 void sendText(std::string const& json);
100 void handleListMetrics(std::string_view deviceName);
101 void handleSubscribe(std::string_view deviceName, std::string_view metricsJson);
102 void handleUnsubscribe(std::string_view deviceName, std::string_view metricsJson);
103 void handleSubscribeLogs(std::string_view deviceName);
104 void handleUnsubscribeLogs(std::string_view deviceName);
105 void handleStartDevices();
106 void handleSmaps(std::string_view deviceName);
107 void handleEnableSignpost(std::string_view deviceName, std::string_view streamsArr);
108 void handleDisableSignpost(std::string_view deviceName, std::string_view streamsArr);
109 size_t findDeviceIndex(std::string_view name) const;
110
111 DriverServerContext& mContext;
112 WSDPLHandler* mHandler;
115 std::vector<std::unordered_set<std::string>> mSubscribedMetrics;
117 std::vector<size_t> mLastLogSeq;
119 std::unordered_set<size_t> mLogSubscriptions;
120};
121
122} // namespace o2::framework
123#endif // O2_FRAMEWORK_STATUSWEBSOCKETHANDLER_H_
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
GLuint const GLchar * name
Definition glcorearb.h:781
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
nlohmann::json json
void beginFragmentation() override
FIXME: not implemented.
void control(char const *frame, size_t s) override
FIXME: not implemented.
void sendSnapshot()
Send a minimal JSON snapshot (device list + basic state, no metrics/logs).
void frame(char const *data, size_t s) override
Handles incoming commands from the MCP client.
void endChunk() override
Invoked whenever we have no more input to process.
void endFragmentation() override
FIXME: not implemented.
void beginChunk() override
Invoked before processing the next round of input.
void headers(std::map< std::string, std::string > const &headers) override
Sends the minimal snapshot on handshake completion.
An handler for a websocket message stream.
Definition HTTPParser.h:149