![]() |
Project
|
#include <StatusWebSocketHandler.h>
Inherits o2::framework::WebSocketHandler.
Public Member Functions | |
| StatusWebSocketHandler (DriverServerContext &context, WSDPLHandler *handler) | |
| ~StatusWebSocketHandler () override | |
| void | headers (std::map< std::string, std::string > const &headers) override |
| Sends the minimal snapshot on handshake completion. | |
| void | frame (char const *data, size_t s) override |
| Handles incoming commands from the MCP client. | |
| void | beginChunk () override |
| Invoked before processing the next round of input. | |
| void | endChunk () override |
| Invoked whenever we have no more input to process. | |
| void | beginFragmentation () override |
| FIXME: not implemented. | |
| void | endFragmentation () 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 | sendUpdate (size_t deviceIndex) |
| void | sendNewLogs (size_t deviceIndex) |
Public Member Functions inherited from o2::framework::WebSocketHandler | |
| virtual | ~WebSocketHandler ()=default |
Additional Inherited Members | |
Public Attributes inherited from o2::framework::WebSocketHandler | |
| size_t | remainingSize = 0 |
| Bytes which are still to be received for the previous, half delivered frame. | |
| size_t | pendingSize = 0 |
| Bytes which are already there from the previous, half delivered frame. | |
| char * | pendingBuffer = nullptr |
| A buffer large enough to contain the next frame to be processed. | |
| size_t | pendingHeaderSize = 0 |
| Bytes from an incomplete header. | |
| char * | pendingHeader = nullptr |
WebSocket handler for the /status endpoint.
Protocol (client → driver): {"cmd":"list_metrics","device":"<name>"} → driver replies with {"type":"metrics_list","device":"<name>","metrics":[...]}
{"cmd":"subscribe","device":"<name>","metrics":["m1","m2",...]} → driver starts including those metrics in subsequent update frames
{"cmd":"unsubscribe","device":"<name>","metrics":["m1","m2",...]} → driver stops sending those metrics
{"cmd":"subscribe_logs","device":"<name>"} → driver starts pushing new log lines for the device
{"cmd":"unsubscribe_logs","device":"<name>"} → driver stops pushing log lines for the device
{"cmd":"enable_signpost","device":"<name>","streams":["device","completion",...]} → enable the named signpost log streams for a device (or the driver if device=="") → known streams: "device","completion","monitoring_service","data_processor_context","stream_context"
{"cmd":"disable_signpost","device":"<name>","streams":["device","completion",...]} → disable the named signpost log streams for a device
{"cmd":"list_signposts"} → driver replies with {"type":"signposts_list","streams":["device","completion",...]} → lists the known stream names
Protocol (driver → client): {"type":"snapshot","devices":[{"name","pid","active","streamingState","deviceState"},...]} → sent once on connect; contains no metrics or logs
{"type":"update","device":<index>,"name":"<name>","metrics":{<subscribed & changed>}} → sent after each metrics cycle for devices with subscribed metrics that changed
{"type":"metrics_list","device":"<name>","metrics":["m1","m2",...]} → reply to list_metrics command
{"type":"log","device":"<name>","level":"<level>","line":"<text>"} → pushed for each new log line from a subscribed device
Definition at line 67 of file StatusWebSocketHandler.h.
| o2::framework::StatusWebSocketHandler::StatusWebSocketHandler | ( | DriverServerContext & | context, |
| WSDPLHandler * | handler | ||
| ) |
Definition at line 224 of file StatusWebSocketHandler.cxx.
|
override |
Definition at line 229 of file StatusWebSocketHandler.cxx.
|
inlineoverridevirtual |
Invoked before processing the next round of input.
Reimplemented from o2::framework::WebSocketHandler.
Definition at line 75 of file StatusWebSocketHandler.h.
|
inlineoverridevirtual |
FIXME: not implemented.
Reimplemented from o2::framework::WebSocketHandler.
Definition at line 77 of file StatusWebSocketHandler.h.
|
inlineoverridevirtual |
FIXME: not implemented.
Reimplemented from o2::framework::WebSocketHandler.
Definition at line 79 of file StatusWebSocketHandler.h.
|
inlineoverridevirtual |
Invoked whenever we have no more input to process.
Reimplemented from o2::framework::WebSocketHandler.
Definition at line 76 of file StatusWebSocketHandler.h.
|
inlineoverridevirtual |
FIXME: not implemented.
Reimplemented from o2::framework::WebSocketHandler.
Definition at line 78 of file StatusWebSocketHandler.h.
Handles incoming commands from the MCP client.
Reimplemented from o2::framework::WebSocketHandler.
Definition at line 240 of file StatusWebSocketHandler.cxx.
|
overridevirtual |
Sends the minimal snapshot on handshake completion.
Reimplemented from o2::framework::WebSocketHandler.
Definition at line 235 of file StatusWebSocketHandler.cxx.
| void o2::framework::StatusWebSocketHandler::sendNewLogs | ( | size_t | deviceIndex | ) |
Push any log lines for deviceIndex that arrived since the last call. No-op if the device is not subscribed for logs.
Definition at line 543 of file StatusWebSocketHandler.cxx.
| void o2::framework::StatusWebSocketHandler::sendSnapshot | ( | ) |
Send a minimal JSON snapshot (device list + basic state, no metrics/logs).
Definition at line 275 of file StatusWebSocketHandler.cxx.
| void o2::framework::StatusWebSocketHandler::sendUpdate | ( | size_t | deviceIndex | ) |
Push an update for device at deviceIndex. Only metrics that are both changed[] and subscribed are included. No-op if nothing subscribed or nothing changed for this device.
Definition at line 311 of file StatusWebSocketHandler.cxx.