From 796ac0d30b781cf284c7e248bb272be6d1feb499 Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 20 Jan 2026 10:39:25 +0530 Subject: [PATCH 1/5] fix: realtime api ref docs. --- eslint.config.js | 3 +- src/lib/utils/references.ts | 3 +- src/partials/databases-events.md | 4 +- src/routes/docs/apis/realtime/+page.markdoc | 93 ++++++++++++++------- 4 files changed, 69 insertions(+), 34 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 22d25668e3..c383d06664 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -24,7 +24,8 @@ export default defineConfig( rules: { // typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects. // see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors - 'no-undef': 'off' + 'no-undef': 'off', + 'svelte/no-navigation-without-resolve': 'off' } }, { diff --git a/src/lib/utils/references.ts b/src/lib/utils/references.ts index 25dd15aad8..5465392f49 100644 --- a/src/lib/utils/references.ts +++ b/src/lib/utils/references.ts @@ -161,10 +161,11 @@ export const serviceMap: Record = { }; export const preferredVersion = writable( - globalThis?.localStorage?.getItem('preferredVersion') as Version + browser ? globalThis?.localStorage?.getItem('preferredVersion') as Version : null ); function getInitialPlatform(): Platform { + if (!browser) return Platform.ClientWeb; const stored = globalThis?.localStorage?.getItem('preferredPlatform') ?? Platform.ClientWeb; // return if this platform is valid if (VALID_PLATFORMS.has(stored as Platform)) { diff --git a/src/partials/databases-events.md b/src/partials/databases-events.md index 0a88c60476..ea03aaf3c3 100644 --- a/src/partials/databases-events.md +++ b/src/partials/databases-events.md @@ -71,9 +71,9 @@ --- -- `databases.*.tables.*.row.*.upsert` +- `databases.*.tables.*.rows.*.upsert` - This event triggers when a row is upserted. - Returns [Document Object](/docs/references/cloud/models/document) + Returns [Row Object](/docs/references/cloud/models/row) --- diff --git a/src/routes/docs/apis/realtime/+page.markdoc b/src/routes/docs/apis/realtime/+page.markdoc index 49dbeea3a9..d0d5462270 100644 --- a/src/routes/docs/apis/realtime/+page.markdoc +++ b/src/routes/docs/apis/realtime/+page.markdoc @@ -181,7 +181,7 @@ val subscription = realtime.subscribe("account") { You can also listen to multiple channels at once by passing an array of channels. This will trigger the callback for any events for all channels passed. -In this example we are listening to the row A and all files by subscribing to the `databases.A.tables.A.rows.A` and `files` channels. +In this example we are listening to a specific row and all files by subscribing to the `databases..tables..rows.` and `files` channels. {% multicode %} ```client-web @@ -191,8 +191,8 @@ const client = new Client() .setEndpoint('https://.cloud.appwrite.io/v1') .setProject(''); -client.subscribe(['tables.A.rows.A', 'files'], response => { - // Callback will be executed on changes for rows A and all files. +client.subscribe(['databases..tables..rows.', 'files'], response => { + // Callback will be executed on changes for the specific row and all files. console.log(response); }); ``` @@ -206,10 +206,10 @@ final client = Client() final realtime = Realtime(client); -final subscription = realtime.subscribe(['databases.A.tables.A.rows.A', 'files']); +final subscription = realtime.subscribe(['databases..tables..rows.', 'files']); subscription.stream.listen((response) { - // Callback will be executed on changes for rows A and all files. + // Callback will be executed on changes for the specific row and all files. print(response); }) ``` @@ -224,8 +224,8 @@ let client = Client() let realtime = Realtime(client) -realtime.subscribe(channels: ["databases.A.tables.A.rows.A", "files"]) { response in - // Callback will be executed on changes for rows A and all files. +realtime.subscribe(channels: ["databases..tables..rows.", "files"]) { response in + // Callback will be executed on changes for the specific row and all files. print(String(describing: response)) } ``` @@ -239,8 +239,8 @@ val client = Client(context) .setProject("") val realtime = Realtime(client) -realtime.subscribe("databases.A.tables.A.rows.A", "files") { - // Callback will be executed on changes for rows A and all files. +realtime.subscribe("databases..tables..rows.", "files") { + // Callback will be executed on changes for the specific row and all files. print(it.toString()) } ``` @@ -383,7 +383,7 @@ The response will look like this: "channels": [ "rows", "databases.default.tables.sample.rows", - "databases.default.tables.sample.rows.63c98b9baea0938e1206" + "databases.default.tables.sample.rows.63c98b9baea0938e1206", ], "timestamp": "2023-01-19 18:30:04.051", "payload": { @@ -412,7 +412,9 @@ The response will look like this: # Channels {% #channels %} -A list of all channels available you can subscribe to. IDs cannot be wildcards. +A list of channels you can subscribe to. Replace `` with your resource ID. IDs cannot be wildcards. + +## Account {% #account %} {% table %} * Channel @@ -420,45 +422,76 @@ A list of all channels available you can subscribe to. IDs cannot be wildcards. --- * `account` * All account related events (session create, name update...) ---- -* `databases..tables..rows` -* Any create/update/delete events to any row in a table + +{% /table %} + +## Databases {% #databases %} + +{% table %} +* Channel +* Description --- * `rows` * Any create/update/delete events to any row --- +* `databases..tables..rows` +* Any create/update/delete events to any row in a table +--- * `databases..tables..rows.` -* Any update/delete events to a given row +* Any create/update/delete events to a given row +{% /table %} + +## Storage {% #storage %} + +{% table %} +* Channel +* Description --- * `files` * Any create/update/delete events to any file --- +* `buckets..files` +* Any create/update/delete events to any file of the given bucket +--- * `buckets..files.` -* Any update/delete events to a given file of the given bucket +* Any create/update/delete events to a given file of the given bucket + +{% /table %} + +## Functions {% #functions %} + +{% table %} +* Channel +* Description --- -* `buckets..files` -* Any update/delete events to any file of the given bucket +* `executions` +* Any execution event +--- +* `executions.` +* Any execution event to a given execution +--- +* `functions.` +* Any execution event to a given function + +{% /table %} + +## Teams & Memberships {% #teams %} + +{% table %} +* Channel +* Description --- * `teams` * Any create/update/delete events to a any team --- * `teams.` -* Any update/delete events to a given team +* Any create/update/delete events to a given team --- * `memberships` * Any create/update/delete events to a any membership --- * `memberships.` -* Any update/delete events to a given membership ---- -* `executions` -* Any update to executions ---- -* `executions.` -* Any update to a given execution ---- -* `functions.` -* Any execution event to a given function +* Any create/update/delete events to a given membership {% /table %} @@ -512,4 +545,4 @@ built up several times by multiple components' life cycles. ## Server SDKs {% #server-sdks %} -We currently are not offering access to realtime with Server SDKs and an API key. \ No newline at end of file +We currently are not offering access to realtime with Server SDKs and an API key. From 365692baac89f63d1413797dce3193d55402f0ce Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 20 Jan 2026 10:42:08 +0530 Subject: [PATCH 2/5] lint. --- src/lib/utils/references.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/utils/references.ts b/src/lib/utils/references.ts index 5465392f49..82ff88c4b6 100644 --- a/src/lib/utils/references.ts +++ b/src/lib/utils/references.ts @@ -161,7 +161,7 @@ export const serviceMap: Record = { }; export const preferredVersion = writable( - browser ? globalThis?.localStorage?.getItem('preferredVersion') as Version : null + browser ? (globalThis?.localStorage?.getItem('preferredVersion') as Version) : null ); function getInitialPlatform(): Platform { From 6f8bb081fc245c5eace7f9997e2089b434ccb8f1 Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 20 Jan 2026 15:33:48 +0530 Subject: [PATCH 3/5] fix: json --- src/routes/docs/apis/realtime/+page.markdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/docs/apis/realtime/+page.markdoc b/src/routes/docs/apis/realtime/+page.markdoc index d0d5462270..6518cdba22 100644 --- a/src/routes/docs/apis/realtime/+page.markdoc +++ b/src/routes/docs/apis/realtime/+page.markdoc @@ -383,7 +383,7 @@ The response will look like this: "channels": [ "rows", "databases.default.tables.sample.rows", - "databases.default.tables.sample.rows.63c98b9baea0938e1206", + "databases.default.tables.sample.rows.63c98b9baea0938e1206" ], "timestamp": "2023-01-19 18:30:04.051", "payload": { From 4b699817858f9583644237ea1de2a5b9c6c844a1 Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 20 Jan 2026 16:28:34 +0530 Subject: [PATCH 4/5] update: content. --- src/routes/docs/apis/realtime/+page.markdoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/docs/apis/realtime/+page.markdoc b/src/routes/docs/apis/realtime/+page.markdoc index d0d5462270..b11738afb0 100644 --- a/src/routes/docs/apis/realtime/+page.markdoc +++ b/src/routes/docs/apis/realtime/+page.markdoc @@ -412,7 +412,7 @@ The response will look like this: # Channels {% #channels %} -A list of channels you can subscribe to. Replace `` with your resource ID. IDs cannot be wildcards. +A list of channels you can subscribe to. Replace `` with your resource ID or use `*` for wildcards. ## Account {% #account %} From d99ebcdaa7212b392b695842aaacd66f426d6e33 Mon Sep 17 00:00:00 2001 From: Darshan Date: Tue, 20 Jan 2026 17:12:50 +0530 Subject: [PATCH 5/5] fix: syntaxes. --- src/routes/docs/apis/realtime/+page.markdoc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/routes/docs/apis/realtime/+page.markdoc b/src/routes/docs/apis/realtime/+page.markdoc index d5b85246fc..86b52ed7d6 100644 --- a/src/routes/docs/apis/realtime/+page.markdoc +++ b/src/routes/docs/apis/realtime/+page.markdoc @@ -59,7 +59,7 @@ let realtime = Realtime(client) // Subscribe to files channel let subscription = realtime.subscribe(channels: ["files"]) { response in - if (message.events!.contains("buckets.*.files.*.create")) { + if (response.events!.contains("buckets.*.files.*.create")) { // Log when a new file is uploaded print(String(describing: response)) } @@ -77,7 +77,7 @@ val client = Client(context) val realtime = Realtime(client) // Subscribe to files channel -let subscription = realtime.subscribe("files") { +val subscription = realtime.subscribe("files") { if(it.events.contains("buckets.*.files.*.create")) { // Log when a new file is uploaded print(it.payload.toString()); @@ -153,10 +153,10 @@ let client = Client() let realtime = Realtime(client) -let subscription = realtime.subscribe(channel: "account", callback: { response in +let subscription = realtime.subscribe(channel: "account") { response in // Callback will be executed on all account events. print(String(describing: response)) -}) +} ``` ```client-android-kotlin @@ -239,7 +239,7 @@ val client = Client(context) .setProject("") val realtime = Realtime(client) -realtime.subscribe("databases..tables..rows.", "files") { +realtime.subscribe(listOf("databases..tables..rows.", "files")) { // Callback will be executed on changes for the specific row and all files. print(it.toString()) } @@ -482,13 +482,13 @@ A list of channels you can subscribe to. Replace `` with your resource ID or * Description --- * `teams` -* Any create/update/delete events to a any team +* Any create/update/delete events to any team --- * `teams.` * Any create/update/delete events to a given team --- * `memberships` -* Any create/update/delete events to a any membership +* Any create/update/delete events to any membership --- * `memberships.` * Any create/update/delete events to a given membership