Skip to content

NIP-CL membership_snapshot: add a per-channel roster version so clients can refresh only changed rosters #9361

Open

Description

@bokhi

What we want to do

A client in about 1,500 channels starts with the compact membership snapshot (kind 39008, #9118). After that, it wants to fetch only the 39002 rosters that changed since its last start.

What's missing

Each snapshot row carries {id, role, channel_type, visibility, archived}, plus one snapshot_id for the whole snapshot. snapshot_id is a hash of the viewer's own rows. It changes when the viewer's own membership changes, but not when another member joins or leaves a channel.

So a client that keeps rosters (member lists, for names and mentions) can't tell from the snapshot which of its saved 39002s are stale. It has to fetch every roster again: in our measurements that is tens of MB per start for a user in about 1,500 channels with about 290 members each.

Proposal

Add an optional per-row roster version, for example roster: "<39002 event id>" (or roster_at: <created_at>), to each 39008 row. A relay that advertises it in NIP-11 lets a client:

  1. read 39008 once (about 200 KB for 1,500 channels);
  2. compare each row's roster version with its saved copy;
  3. fetch only the changed 39002s by ids.

Why not elsewhere

In our fork we did this with a separate REQ extension (group_heads: 1, which returns {d, id, created_at} per 39002). That costs about 0.21 MB for 1,500 groups, against 25 MB for the full rosters. Folding it into NIP-CL would avoid a second, relay-specific read path. It would also keep guests scoped by the same rules as 39008.

Happy to send a PR if this direction fits NIP-CL.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions