# Multiplayer cloud editing When several people open `lattice gui` against the **same shared cloud (Postgres) database**, Lattice 1.16 makes concurrent editing live and loss-free. Everything here is **cloud-only** — a local SQLite GUI is a single writer and behaves exactly as before. ## How it works Each person runs their own local GUI server, all pointed at one cloud Postgres — each connecting as their **own scoped, non-superuser Postgres role** (see [cloud.md](cloud.md)). Postgres Row-Level Security confines every read and write to the rows that role may see, so collaboration is naturally scoped: you only ever see and flash on changes to rows shared with you. Two channels carry change: - **`RealtimeBroker`** holds a dedicated `pg.Client` running `LISTEN lattice_changes` and forwards every `NOTIFY` to the browser over SSE (`GET /api/realtime/stream`). Use a **session-mode** connection (e.g. the Supabase pooler on port 5432) — transaction-mode poolers silently drop `LISTEN`. A transaction-mode proxy can drop the registration _without_ closing the socket, so the broker also runs a periodic **backstop poll** that re-delivers missed changes regardless; see the managed-Postgres / RDS Proxy notes in `cloud.md`. The poll interval is configurable via `startGuiServer`'s `realtimeWatchdogMs` (0 disables it). - The **`__lattice_changes`** table is the append-only change feed: each row carries a monotonic `seq`, the `table_name`, the `pk`, the `op` (`upsert`/`delete`), the `owner_role`, and `created_at`. The per-table RLS trigger writes one entry per insert/update/delete; an `AFTER INSERT` trigger emits the NOTIFY carrying only that metadata — **never row content** — so clients re-fetch the affected row _through RLS_ (which keeps the payload tiny and never broadcasts another member's data). ## What you see - **Live share / un-share** — when a row's owner changes its visibility (`private` ↔ `everyone`, via `/api/cloud/share`), the row appears or disappears in every other member's view on the next broadcast; no page reload. Sharing is per-**row** under RLS, not per-table. - **Last edited by** — the row detail shows `Last edited by ·