![]() |
VR-Forces Developer's Guide
|
DtContactReportUpdateSender - Encapsulates all contact-report-specific WebLVC message building and sending logic.
Unlike entity/aggregate/TG senders, this class does not accept a processor parameter. Contact report data is sourced from the global role-based spot-report perspective system via DtVrfManager::contactReportsForRoles().
Only Player sessions with at least one assigned role that has a configured contact-report perspective will receive messages. All other sessions (anonymous, Observer, roles without a perspective) receive nothing.
Thread safety: methods are re-entrant as long as callers pass distinct session references. Callers are responsible for session locking as described per method.
Public Member Functions | |
| void | sendInitialState (const oatpp::websocket::WebSocket &conn, DtWebLvcClientSession &session) |
| void | sendPeriodicUpdates (const oatpp::websocket::WebSocket &conn, DtWebLvcClientSession &session) |
Private Member Functions | |
| Json::Value | buildUpdateMultipleMessage (DtWebLvcClientSession &session, std::vector< DtChangedItem< DtDatasource::DtContactReportSnapshot >> &items) |
| void | sendObjectsDeleted (const oatpp::websocket::WebSocket &conn, DtWebLvcClientSession &session, const std::vector< std::string > &uuids) |
| bool | hasPlayerRoles (const DtWebLvcClientSession &session, std::vector< std::string > &outRoles) const |
| void DtContactReportUpdateSender::sendInitialState | ( | const oatpp::websocket::WebSocket & | conn, |
| DtWebLvcClientSession & | session | ||
| ) |
Send initial state of all contact reports visible to the session's roles. Builds and sends a single ContactReportAttributeUpdateMultiple message. Does nothing for sessions without Player roles. Caller must NOT hold session->mutex.
| void DtContactReportUpdateSender::sendPeriodicUpdates | ( | const oatpp::websocket::WebSocket & | conn, |
| DtWebLvcClientSession & | session | ||
| ) |
Query all contact reports visible to the session's roles, detect changes against the session cache, send a batch ContactReportAttributeUpdateMultiple for changed reports, and send ObjectDeletedMultiple for any that have disappeared. Does nothing for sessions without Player roles (also sends deletions if roles were removed mid-session). Caller must NOT hold session->mutex.
|
private |
Build a ContactReportAttributeUpdateMultiple message from a list of snapshots. Updates session.lastSentContactReportAttributes for each snapshot included. Caller must hold session.mutex.
|
private |
Send an ObjectDeletedMultiple message for contact reports that have disappeared. Clears each report's cache entry. Caller must NOT hold session.mutex.
|
private |
If the session is a Player session with assigned roles, populate outRoles and return true. Returns false for anonymous sessions, non-Player sessions, or sessions with no assigned roles.