|
MantisBase v0.3.4
|
#include <sse.h>
Public Member Functions | |
| SSESession (const std::string &sessionId, const std::set< std::string > &topics, const json &auth=json::object(), const json &verification=json::object()) | |
| void | queueEvent (const std::string &eventType, const json &data) |
| bool | waitForEvent (std::string &eventType, json &data, std::chrono::milliseconds timeout) |
| bool | isInterestedIn (const json &change_event) const |
| json | formatEvent (const json &change_event) const |
| void | updateActivity () |
| void | updateTopics (std::set< std::string > &topics) |
| auto | getLastActivity () const |
| void | close () |
| bool | isActive () const |
| const std::string & | getClientID () const |
| const std::set< std::string > & | getTopics () const |
| void | setTopics (const std::set< std::string > &topics) |
Per-client SSE session: holds subscribed topics, auth details, and queues events (change, ping).
| mb::SSESession::SSESession | ( | const std::string & | sessionId, |
| const std::set< std::string > & | topics, | ||
| const json & | auth = json::object(), |
||
| const json & | verification = json::object() |
||
| ) |
| void mb::SSESession::close | ( | ) |
Mark session inactive and wake any waiters (disconnect).
Format a change event for SSE (topic, action, entity, row_id, data, timestamp).
| const std::string & mb::SSESession::getClientID | ( | ) | const |
| auto mb::SSESession::getLastActivity | ( | ) | const |
| const std::set< std::string > & mb::SSESession::getTopics | ( | ) | const |
| bool mb::SSESession::isActive | ( | ) | const |
| bool mb::SSESession::isInterestedIn | ( | const json & | change_event | ) | const |
True if this session is subscribed to the topic implied by change_event.
| void mb::SSESession::queueEvent | ( | const std::string & | eventType, |
| const json & | data | ||
| ) |
Queue an event (e.g. "change", "ping") to be sent to the client.
| void mb::SSESession::setTopics | ( | const std::set< std::string > & | topics | ) |
| void mb::SSESession::updateActivity | ( | ) |
| void mb::SSESession::updateTopics | ( | std::set< std::string > & | topics | ) |
| bool mb::SSESession::waitForEvent | ( | std::string & | eventType, |
| json & | data, | ||
| std::chrono::milliseconds | timeout | ||
| ) |
Block until the next event is available or timeout; returns true if event was read.