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
58 ~StatusWebSocketHandler() override;
59
61 void headers(std::map<std::string, std::string> const& headers) override;
63 void frame(char const* data, size_t s) override;
64 void beginChunk() override {}
65 void endChunk() override {}
66 void beginFragmentation() override {}
67 void endFragmentation() override {}
68 void control(char const* frame, size_t s) override {}
69
71 void sendSnapshot();
75 void sendUpdate(size_t deviceIndex);
78 void sendNewLogs(size_t deviceIndex);
79
80 private:
81 void sendText(std::string const& json);
82 void handleListMetrics(std::string_view deviceName);
83 void handleSubscribe(std::string_view deviceName, std::string_view metricsJson);
84 void handleUnsubscribe(std::string_view deviceName, std::string_view metricsJson);
85 void handleSubscribeLogs(std::string_view deviceName);
86 void handleUnsubscribeLogs(std::string_view deviceName);
87 size_t findDeviceIndex(std::string_view name) const;
88
89 DriverServerContext& mContext;
90 WSDPLHandler* mHandler;
93 std::vector<std::unordered_set<std::string>> mSubscribedMetrics;
95 std::vector<size_t> mLastLogSeq;
97 std::unordered_set<size_t> mLogSubscriptions;
98};
99
100} // namespace o2::framework
101#endif // O2_FRAMEWORK_STATUSWEBSOCKETHANDLER_H_
nlohmann::json json
GLuint const GLchar * name
Definition glcorearb.h:781
GLboolean * data
Definition glcorearb.h:298
Defining PrimaryVertex explicitly as messageable.
Definition Cartesian.h:288
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:137