MantisBase v0.3.4
Loading...
Searching...
No Matches
mb::SSEMgr Class Reference

#include <sse.h>

Public Member Functions

 SSEMgr ()=default
 
 ~SSEMgr ()
 
std::string createSession (const std::set< std::string > &initial_topics)
 
std::shared_ptr< SSESessionfetchSession (const std::string &session_id)
 
void removeSession (const std::string &session_id)
 
void updateActivity (const std::string &session_id)
 
std::shared_ptr< mb::SSESessiongetSession (const std::string &sessionId)
 
void broadcastChange (const json &change_event)
 
size_t getSessionCount ()
 
void start ()
 
void stop ()
 
bool isRunning () const
 

Static Public Member Functions

static void createRoutes ()
 
static std::function< void(MantisRequest &, MantisResponse &)> handleSSESession ()
 
static std::function< void(MantisRequest &, MantisResponse &)> handleSSESessionUpdate ()
 

Detailed Description

Manages SSE sessions, routes realtime change events, and registers GET/POST /api/v1/realtime.

Constructor & Destructor Documentation

◆ SSEMgr()

mb::SSEMgr::SSEMgr ( )
default

◆ ~SSEMgr()

mb::SSEMgr::~SSEMgr ( )

Member Function Documentation

◆ broadcastChange()

void mb::SSEMgr::broadcastChange ( const json change_event)

Push a change event to all sessions interested in its topic.

◆ createRoutes()

void mb::SSEMgr::createRoutes ( )
static

Register GET and POST /api/v1/realtime routes.

◆ createSession()

std::string mb::SSEMgr::createSession ( const std::set< std::string > &  initial_topics)

Create a new SSE session with the given topics and optional auth details; returns client_id (session id).

◆ fetchSession()

std::shared_ptr< mb::SSESession > mb::SSEMgr::fetchSession ( const std::string &  session_id)

◆ getSession()

std::shared_ptr< mb::SSESession > mb::SSEMgr::getSession ( const std::string &  sessionId)

◆ getSessionCount()

size_t mb::SSEMgr::getSessionCount ( )

◆ handleSSESession()

std::function< void(mb::MantisRequest &, mb::MantisResponse &)> mb::SSEMgr::handleSSESession ( )
static

◆ handleSSESessionUpdate()

std::function< void(mb::MantisRequest &, mb::MantisResponse &)> mb::SSEMgr::handleSSESessionUpdate ( )
static

◆ isRunning()

bool mb::SSEMgr::isRunning ( ) const

◆ removeSession()

void mb::SSEMgr::removeSession ( const std::string &  session_id)

Remove session and close it (disconnect).

◆ start()

void mb::SSEMgr::start ( )

◆ stop()

void mb::SSEMgr::stop ( )

◆ updateActivity()

void mb::SSEMgr::updateActivity ( const std::string &  session_id)

The documentation for this class was generated from the following files: