Skip to main content

validate_interaction

Function validate_interaction 

Source
pub async fn validate_interaction<B: SceneBackend>(
    backend: &B,
    caller: &B::CallerCtx,
    account_id: &Id,
    event: &SceneInteractionEvent,
) -> Result<Option<SceneInteractionEvent>, B::Error>
Expand description

The SceneInteractionEvent to relay for a frame a client sent, or None to discard it (draft-atwood-jmap-scene-wss-00 §Client-to-Server Submission).

caller is the sending connection’s authenticated identity and account_id the account the region and object are read from. “The server sets userId on the relayed event to the authenticated user’s userId; a userId supplied in the frame is ignored”, so the returned event is event with userId replaced by the caller’s. The frame is relayable when its accountId is account_id, the caller has an active avatar (leftAt null) “in the region identified by accountId and regionId”, and its objectId is a SceneObject in that region with interactable true. On None the server “discards the frame and returns no error to the sender”; on Some it relays the returned event, filtered per recipient by should_deliver.

The opaque data is not inspected; size limits on it are deployment-defined, as is the §Rate Limiting SHOULD of five events per user per region per second.

§Errors

Returns the backend’s error if reading the caller’s userId, its avatars or the object fails.