MantisBase v0.3.4
Loading...
Searching...
No Matches
sse.h File Reference

Server-Sent Events (SSE) manager for the realtime API. More...

#include <condition_variable>
#include <functional>
#include <mutex>
#include <queue>
#include <set>
#include <thread>
#include <unordered_map>
#include <nlohmann/json.hpp>
#include "realtime.h"
Include dependency graph for sse.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  mb::SSESession
 
class  mb::SSEMgr
 

Namespaces

namespace  mb
 router.h
 

Detailed Description

Server-Sent Events (SSE) manager for the realtime API.

Exposes GET and POST /api/v1/realtime:

  • GET /api/v1/realtime?topics=... — Opens an SSE connection with a comma-separated list of topics (entity names or entity:row_id). Returns a session (client_id) and streams events: connected, ping, change (insert/update/delete).
  • POST /api/v1/realtime — Updates topics for an existing session (JSON body: client_id, topics). Clearing topics disconnects the SSE session.

Change events are driven by realtime.h (SQLite/PostgreSQL). Access control uses entity list/get rules for the requested topics.

See also
realtime.h