pub struct OnDisconnect { /* private fields */ }Expand description
Async handle for scheduling writes that run when the client disconnects.
Mirrors the surface of the JS SDK (packages/database/src/api/OnDisconnect.ts).
Operations resolve server value placeholders before being sent to the realtime
backend and require an active WebSocket transport for full server-side
semantics. When the runtime falls back to the HTTP long-poll transport the
commands are queued locally and flushed when Database::go_offline() runs,
which preserves graceful shutdowns but cannot detect abrupt connection loss.
Implementations§
Source§impl OnDisconnect
impl OnDisconnect
Sourcepub async fn set<V>(&self, value: V) -> DatabaseResult<()>
pub async fn set<V>(&self, value: V) -> DatabaseResult<()>
Schedules a write for when the client disconnects.
Mirrors OnDisconnect.set() from the JS SDK. The payload is normalised
using the same server timestamp/increment resolution as immediate writes
so placeholders resolve against the current backend value.
Sourcepub async fn set_with_priority<V, P>(
&self,
value: V,
priority: P,
) -> DatabaseResult<()>
pub async fn set_with_priority<V, P>( &self, value: V, priority: P, ) -> DatabaseResult<()>
Schedules a write together with its priority for disconnect.
Sourcepub async fn update(
&self,
updates: JsonMap<String, Value>,
) -> DatabaseResult<()>
pub async fn update( &self, updates: JsonMap<String, Value>, ) -> DatabaseResult<()>
Schedules an update when the client disconnects.
Sourcepub async fn remove(&self) -> DatabaseResult<()>
pub async fn remove(&self) -> DatabaseResult<()>
Ensures the value at this location is deleted when the client disconnects.
Sourcepub async fn cancel(&self) -> DatabaseResult<()>
pub async fn cancel(&self) -> DatabaseResult<()>
Cancels all pending on-disconnect operations.
Trait Implementations§
Source§impl Clone for OnDisconnect
impl Clone for OnDisconnect
Source§fn clone(&self) -> OnDisconnect
fn clone(&self) -> OnDisconnect
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more