Skip to main content

ChangeNotifier

Trait ChangeNotifier 

Source
pub trait ChangeNotifier: Send + Sync {
    // Required methods
    fn notify(&self, event: &ChangeEvent);
    fn notify_presence(&self, json: &str);

    // Provided method
    fn notify_crdt(&self, _entity: &str, _row_id: &str, _snapshot: &[u8]) { ... }
}
Expand description

Receives change notifications for real-time sync.

On the self-hosted server this broadcasts to WebSocket + SSE hubs. On Workers this can be a no-op or post to a Durable Object.

Required Methods§

Source

fn notify(&self, event: &ChangeEvent)

Source

fn notify_presence(&self, json: &str)

Provided Methods§

Source

fn notify_crdt(&self, _entity: &str, _row_id: &str, _snapshot: &[u8])

Ship a binary CRDT update for one row to subscribed clients. Called after every successful write to a CRDT-mode entity. The payload is a Loro snapshot (or eventually an incremental delta); the implementation owns wire-format framing — see encode_crdt_frame for the canonical Pylon shape.

Default impl is a no-op so backends without WebSocket support (Workers, no-op notifier) compile without ceremony.

Implementors§