Motion Master 6.0.0-alpha.50
Next-generation motion control software
Loading...
Searching...
No Matches
monitoring_api.h
Go to the documentation of this file.
1#pragma once
2
3#include <expected>
4#include <nlohmann/json_fwd.hpp>
5#include <optional>
6#include <string>
7#include <string_view>
8
9#include "node/monitoring.h"
10
11namespace mm {
12
14struct WsCommand {
15 enum class Action { Subscribe, Unsubscribe };
17 std::string topic;
18};
19
30std::optional<WsCommand> parseWsCommand(std::string_view message);
31
47std::expected<mm::node::Monitoring, std::string> parseMonitoringRequest(const nlohmann::json& body);
48
49} // namespace mm
Definition cert_info.cc:13
std::optional< WsCommand > parseWsCommand(std::string_view message)
Parses an inbound monitoring-WebSocket text message into a subscribe/unsubscribe command.
Definition monitoring_api.cc:16
std::expected< mm::node::Monitoring, std::string > parseMonitoringRequest(const nlohmann::json &body)
Parses a POST /api/monitorings request body into a Monitoring config.
Definition monitoring_api.cc:47
A client request received over the monitoring WebSocket to (un)subscribe to a topic.
Definition monitoring_api.h:14
Action
Definition monitoring_api.h:15
std::string topic
Validated URL-safe topic (a monitoring id).
Definition monitoring_api.h:17
Action action
Definition monitoring_api.h:16