Class SubscriptionTransportProvider
Defined in File subscription_transport.hpp
Inheritance Relationships
Derived Type
public ros2_medkit_gateway::SseTransportProvider(Class SseTransportProvider)
Class Documentation
-
class SubscriptionTransportProvider
Virtual interface for pluggable subscription transport protocols.
SSE is the built-in default (SOVD-compliant). Non-SSE protocols (MQTT, WebSocket, Zenoh) are vendor extensions.
Subclassed by ros2_medkit_gateway::SseTransportProvider
Public Functions
-
virtual ~SubscriptionTransportProvider() = default
-
virtual std::string protocol() const = 0
Protocol identifier: “sse” (standard), or vendor extension.
-
virtual tl::expected<std::string, std::string> start(const CyclicSubscriptionInfo &info, ResourceSamplerFn json_sampler, GatewayNode *node) = 0
Start delivery for a subscription. Returns event_source URI for client.
-
virtual void notify_update(const std::string &sub_id) = 0
Subscription interval/duration changed. Transport must re-read info.
-
virtual void stop(const std::string &sub_id) = 0
Stop delivery for a subscription.
For HTTP-based transports (SSE), the HTTP server thread join handles synchronous stop - stop() removes state so the streaming loop exits on its next is_active() check. GatewayNode::~GatewayNode() calls stop_rest_server() before shutdown_all() to ensure this ordering.
Non-HTTP transports MUST ensure all delivery threads have stopped before returning from this method.
-
inline virtual bool handle_client_connect(const std::string &sub_id, const httplib::Request &req, httplib::Response &res)
Handle HTTP client connection (SSE: chunked provider, WebSocket: upgrade). MQTT/Zenoh: return false (not HTTP-based).
-
virtual ~SubscriptionTransportProvider() = default