cpp Rest API master
C++ library for REST API access with Qt, Curl and cpp-httplib backends
 
Loading...
Searching...
No Matches
cpp_restapi::ISseConnection Struct Referenceabstract

Interface for SSE (Server-Sent Events) connections. More...

#include <isse_connection.hpp>

Public Types

using EventCallback = std::function<void(const SseEvent&)>
 

Public Member Functions

virtual ~ISseConnection ()=default
 
virtual void subscribe (const std::string &request, EventCallback callback)=0
 Subscribe to an SSE endpoint.
 
virtual void close ()=0
 Stop receiving events and close the SSE connection.
 

Detailed Description

Interface for SSE (Server-Sent Events) connections.

Provides streaming subscription to an SSE endpoint. Unlike IConnection::get() which returns a complete response, SSE delivers events continuously via a callback.

Member Typedef Documentation

◆ EventCallback

using cpp_restapi::ISseConnection::EventCallback = std::function<void(const SseEvent&)>

Constructor & Destructor Documentation

◆ ~ISseConnection()

virtual cpp_restapi::ISseConnection::~ISseConnection ( )
virtualdefault

Member Function Documentation

◆ close()

virtual void cpp_restapi::ISseConnection::close ( )
pure virtual

Stop receiving events and close the SSE connection.

◆ subscribe()

virtual void cpp_restapi::ISseConnection::subscribe ( const std::string & request,
EventCallback callback )
pure virtual

Subscribe to an SSE endpoint.

Parameters
requestAPI endpoint path (e.g. "events" or "api/v1/events")
callbackfunction called for each received SSE event

The documentation for this struct was generated from the following file: