Expand description
Realtime Community (Concord) subscription, routing, dispatch, and control-follow.
The per-event cryptographic engine (inbound::process_incoming) already lives in core;
this module is the realtime plumbing around it — the relay subscription, the pseudonym→channel
route maps, the dispatch of typed inbound::IncomingEvents to an InboundEventHandler, and
the control/rekey realtime-follow. It is consumed by crate::VectorCore::listen so headless
clients (SDK, CLI, bots) get realtime Community delivery through the same handler as DMs.
Functions§
- clear
- Clear all realtime route/subscription state. Call from
swap_sessionso a swapped-in account can’t read the prior account’s channel keys / banned sets. - dispatch_
event - Route an arriving Community event: a CONTROL/REKEY edition triggers a realtime control refresh;
any other (message/reaction/edit/delete/presence/typing/webxdc/kick) is opened against its
channel via
inbound::process_incoming, persisted, and dispatched tohandler.sessionstraddles the relay I/O so a mid-flight account swap can’t write into the swapped-in account. - poolwide_
subscription_ id - The pool-wide subscription id (the path that streams on Android, where the
targeted
subscribe_toregisters but never delivers). The listen loop must OR this withsubscription_id, else events arriving under the pool-wide sub match no branch and are silently dropped. - rebuild_
routes - Rebuild ONLY the in-memory route maps from the persisted communities, WITHOUT touching the live
relay subscription. Refreshes each cached
Channel(incl. itsbannedset) so a received ban/unban takes live effect without a full resubscribe. Returns the pseudonyms + relays a caller also resubscribing needs. - refresh_
control - Realtime control-plane follow: walk a re-founding, fold the control plane (banlist/roles/
metadata/invites), follow channel rekeys, then resubscribe at the new pseudonyms if any epoch
advanced (else just refresh the route maps so the new banlist takes live effect). Mirrors the
Tauri
refresh_community_controlorchestration over the already-corecatch_up_*primitives. - refresh_
subscription - (Re)build the Community subscription: rebuild the route maps, then open TWO subscriptions over the
same filter — a targeted
subscribe_to(streams on desktop) and a pool-widesubscribe(streams on Android).process_incomingdedups by outer-event id, so overlap folds exactly once. - subscription_
id - The subscription id of the live Community subscription, if any. Lets a notification loop test whether an arriving event belongs to the Community sub.
- teardown_
local - Tear down a community locally on a received removal (kick/leave/ban), RETAINING the held epoch
keys (so a self-scrub republish/erase still works), then refresh the subscription so we stop
listening on its pseudonyms. Headless consumers can call this from
on_community_self_removed; the GUI does a richer teardown (prune chats/relays + republish the list) in its handler instead.