pub struct SceneEventHub { /* private fields */ }websocket only.Expand description
The server-wide source of Scene ephemeral events: the deployment
publishes each event here, and every connection’s
SceneStreamHandler decides whether its client receives it.
The hub also holds the per-user interaction rate limit, so that it
counts a user’s frames over all of that user’s connections:
“SceneInteractionEvent: no more than five events per user per region
per second. Frames above this rate MAY be silently dropped”
(§Rate Limiting). Frames over it are dropped.
The hub keeps the last capacity events for connections that fall
behind; a connection that falls further behind skips the events it
missed. Clones share the hub.
Implementations§
Source§impl SceneEventHub
impl SceneEventHub
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
A hub that buffers capacity events per slow connection, with the
draft’s interaction limit of five per user per region per second.
§Panics
If capacity is 0.
Sourcepub fn with_interaction_window(
capacity: usize,
window: Option<Duration>,
) -> Self
pub fn with_interaction_window( capacity: usize, window: Option<Duration>, ) -> Self
Sourcepub fn publish(&self, event: SceneEvent)
pub fn publish(&self, event: SceneEvent)
Offer event to every connection. With none connected it is
dropped.