cpp Rest API master
C++ library for REST API access with Qt, Curl and cpp-httplib backends
 
Loading...
Searching...
No Matches
isse_connection.hpp
Go to the documentation of this file.
1#ifndef ISSE_CONNECTION_HPP_INCLUDED
2#define ISSE_CONNECTION_HPP_INCLUDED
3
4#include <functional>
5#include <string>
6
7#include "sse_event.hpp"
8
9namespace cpp_restapi
10{
19 {
20 using EventCallback = std::function<void(const SseEvent&)>;
21
22 virtual ~ISseConnection() = default;
23
29 virtual void subscribe(const std::string& request, EventCallback callback) = 0;
30
34 virtual void close() = 0;
35 };
36}
37
38#endif
Definition base_connection.hpp:13
Interface for SSE (Server-Sent Events) connections.
Definition isse_connection.hpp:19
virtual ~ISseConnection()=default
virtual void subscribe(const std::string &request, EventCallback callback)=0
Subscribe to an SSE endpoint.
std::function< void(const SseEvent &)> EventCallback
Definition isse_connection.hpp:20
virtual void close()=0
Stop receiving events and close the SSE connection.
Represents a single Server-Sent Event.
Definition sse_event.hpp:15