Realtime
Follow the server's change feed for a table so chats, boards and queues update as other users write.
On this page
Every write through the data API emits a row-changed event on the topic row-changed:<table>. app.live subscribes to it over server-sent events; each event bumps the table's revision and refreshes its working set, so query hooks refetch on their own.
Live changes
app.livemethod
Follow the server's change feed for a table (chat, boards, queues). Subscriptions are reference-counted per table and reconnect after a dropped connection.
app.live(entity: string): () => voidParameters
| Name | Type | Description |
|---|---|---|
entityrequired | string | The table name. |
- Returns
- An unsubscribe function. Return it from useEffect.
- Errors
- Does not throw.
- Permissions
- Subscribing to row-changed:<table> needs read access to the table. Events carry no row data; the refetch they trigger goes through row-level security.
useEffect(() => app.live("messages"), [app]);
const thread = useEntityQuery("messages", { filter: [{ field: "thread", op: "eq", value: id }] });Source: packages/appkit/src/kits/primitives/app-handle.ts:185