pub struct Registry { /* private fields */ }Expand description
The awareness roster of one application.
Implementations§
Source§impl Registry
impl Registry
pub fn new(config: Config) -> Arc<Registry>
Sourcepub fn watch(&self) -> Receiver<Value>
pub fn watch(&self) -> Receiver<Value>
Wake on every change to it. A subscription watches this only when the program’s page
reads awareness — a program that never asks must not re-render when somebody navigates.
Sourcepub fn refused(&self) -> u64
pub fn refused(&self) -> u64
How many joins the capacity refused, for the life of this process.
Sourcepub fn oversized(&self) -> u64
pub fn oversized(&self) -> u64
How many contributions the per-actor bound refused, for the life of this process.
Sourcepub fn join(self: &Arc<Self>, actor: &str, contribution: Value) -> Guard
pub fn join(self: &Arc<Self>, actor: &str, contribution: Value) -> Guard
Record a connection’s first contribution. The roster holds it until the guard is dropped.
A guard for crate::presence::Guard’s reason: a subscription ends by returning, by
erroring or by its socket dying, and a roster that only removed an actor on the happy path
would fill up with people who left hours ago.
Sourcepub fn update(&self, actor: &str, contribution: Value) -> bool
pub fn update(&self, actor: &str, contribution: Value) -> bool
Publish a new contribution for an actor already in the roster.
Silently does nothing for an actor that is not — the capacity refused them, and a client navigating should not be a way to get in through a different door.
Returns whether the roster changed, which is what saves a re-render: the common navigation republishes the same route.