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

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

#include <functional>
#include <mutex>
#include <set>
#include <thread>
#include <unordered_map>
#include <nlohmann/json.hpp>
#include <drogon/HttpResponse.h>
#include "realtime.h"
#include "realtime_session.h"
#include "types.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::MbSSESession
 Per-client SSE session state and async stream writer. More...
class  mb::MbSSEMgr
 Manages SSE routes, sessions, broadcast, and shared WebSocket cleanup. More...

Namespaces

namespace  mb

Detailed Description

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

Exposes GET and POST /api/v1/realtime:

  • GET /api/v1/realtime — Opens an SSE connection (optional topics query). Returns client_id in the connected event.
  • POST /api/v1/realtime — Sets topics for an existing session (JSON body: client_id, topics, optional token). Returns granted topics and denied entries.

Authentication is optional at connect; invalid tokens are treated as guest. MbAuth can be upgraded on POST subscribe but not downgraded or switched to another user.

See also
realtime_session.h
realtime.h
ws.h