![]() |
VR-Forces Developer's Guide
|
DtInteractionSender - Orchestrates all interaction-type sub-senders for one WebSocket connection.
Owns a list of DtIInteractionTypeSender instances (one per interaction category, e.g. fire/detonation). Each sub-sender also owns a DtIInteractionEventSource. Before the interaction processor is added to DtVrfManager, call registerEventSourcesWith() to transfer those sources into the processor.
On each timer tick, sendPendingInteractions() collects filtered records from every sub-sender and, if any are present, emits a single InteractionMultiple JSON message to the client.
To add a new interaction type: construct and push_back a new sub-sender in the constructor. No other code in this class changes.
Public Member Functions | |
| DtInteractionSender () | |
| ~DtInteractionSender ()=default | |
| void | registerEventSourcesWith (DtInteractionProcessor &proc) |
| void | sendPendingInteractions (const oatpp::websocket::WebSocket &conn, DtWebLvcClientSession &session) |
Private Attributes | |
| std::vector< std::unique_ptr < DtIInteractionTypeSender > > | myTypeSenders |
| DtInteractionSender::DtInteractionSender | ( | ) |
|
default |
| void DtInteractionSender::registerEventSourcesWith | ( | DtInteractionProcessor & | proc | ) |
Register each sub-sender's event source with proc. Must be called before DtVrfManager::addProcessor(proc).
| void DtInteractionSender::sendPendingInteractions | ( | const oatpp::websocket::WebSocket & | conn, |
| DtWebLvcClientSession & | session | ||
| ) |
Collect filtered interactions from all sub-senders and send one InteractionMultiple message if any interactions are pending.
| conn | Active WebSocket connection — must not be locked. |
| session | Per-connection session. Caller must NOT hold session.mutex. |
|
private |