Expand description
v2 realtime — the authors-based live subscription + dispatch.
v2 addresses planes by their group pubkey (CORD-01), not v1’s #z tag, so
the subscription is {kinds:[1059,21059], authors:[…plane pubkeys…]}. A
received event is routed to the owning community and handed to the shared
inbound::dispatch_wrap, which fires the protocol-agnostic
InboundEventHandler the SDK’s on_message consumes.
The kind-1059 dispatch rule (CLAUDE.md A4): the listen loop tries this v2
path for events on the v2 subscription; DM gift wraps and 3313 Direct Invites
(both #p=me) stay on the DM subscription — the author-set here never
includes an identity key, so the two never collide.
Functions§
- clear
- Clear the v2 realtime state on a session reset (called from
swap_sessionalongside v1’s clear), so a stale sub id / author-set can’t leak across accounts. - dispatch_
event - Route an arriving v2 wrap: find the held community whose plane it opens under
and fire the matching handler callback (via the shared bridge). Persistence to
the local DB is deferred (bots deliver via the callback; GUI history is v1 for
now).
sessiongates against a mid-flight account swap. - load_
held_ v2 - Load every locally-held, LIVE v2 community (dispatching each id by its
stored protocol). The realtime layer folds these into the subscription +
routing, so excluding a DISSOLVED community here is what enforces CORD-02 §9
on the receive side: its chat/control/rekey planes stop being subscribed and
an arriving wrap for it is
NotOurs(dropped, never honored). Held keys still open old history through the explicit read paths — this only stops NEW events. - plane_
authors - Every plane pubkey a set of v2 communities publishes under that
inbound::dispatch_wraphandles — the subscription author-set. Per community: the guestbook, the control plane, and each channel’s current Chat-Plane address. Pure + deterministic (deduped, sorted) — the testable core. - poolwide_
subscription_ id - refresh_
subscription - Refresh the v2 subscription for the held communities: register
{kinds:[1059,21059], authors:[…]}on their relays (targeted + pool-wide, mirroring v1). Idempotent on an unchanged author-set. - subscription_
id