![]() |
VR-Forces Developer's Guide
|
DtAggregateUpdateSender - Encapsulates all aggregate-specific WebLVC message building and sending logic.
This class is stateless with respect to individual clients. All per-client state lives in DtWebLvcClientSession and is passed by reference. The class may be instantiated once on the listener and reused for every connection.
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, DtAggregateProcessor &processor) |
| void | sendPeriodicUpdates (const oatpp::websocket::WebSocket &conn, DtWebLvcClientSession &session, DtAggregateProcessor &processor) |
Private Member Functions | |
| Json::Value | buildUpdateMultipleMessage (DtWebLvcClientSession &session, std::vector< DtChangedItem< DtDatasource::DtAggregateSnapshot >> &items) |
| void | sendObjectsDeleted (const oatpp::websocket::WebSocket &conn, DtWebLvcClientSession &session, const std::vector< std::string > &objectNames) |
| bool | matchesSubscription (const DtDatasource::DtAggregateSnapshot &snapshot, const DtWebLvcClientSession &session) |
| DtDatasource::DtAggregateSnapshot | applyRoleModifications (const DtDatasource::DtAggregateSnapshot &snapshot, const DtWebLvcClientSession &session) |
| void DtAggregateUpdateSender::sendInitialState | ( | const oatpp::websocket::WebSocket & | conn, |
| DtWebLvcClientSession & | session, | ||
| DtAggregateProcessor & | processor | ||
| ) |
Send initial state of all aggregates to a newly connected client. Builds and sends a single AggregateAttributeUpdateMultiple message. Caller must NOT hold session->mutex.
| void DtAggregateUpdateSender::sendPeriodicUpdates | ( | const oatpp::websocket::WebSocket & | conn, |
| DtWebLvcClientSession & | session, | ||
| DtAggregateProcessor & | processor | ||
| ) |
Query all aggregates from the processor, detect changes against the session cache, send a batch AggregateAttributeUpdateMultiple for changed aggregates, and send ObjectDeleted for any that have disappeared. Caller must NOT hold session->mutex.
|
private |
Build an AggregateAttributeUpdateMultiple message from a list of snapshots. Updates session.lastSentAggregateAttributes for each snapshot included. Caller must hold session.mutex.
|
private |
Send an ObjectDeletedMultiple message for a set of aggregates that have disappeared. Clears each object's cache entry and stats. Caller must NOT hold session.mutex.
|
private |
Return true if the snapshot should be sent to this client.
|
private |
Return a copy of snapshot with role-based field modifications applied (e.g. availableCommands cleared when the aggregate is not commanded by the session's roles). Pass-through for non-Player sessions.