Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions src/partials/databases-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

---

Expand Down
103 changes: 68 additions & 35 deletions src/routes/docs/apis/realtime/+page.markdoc
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand All @@ -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());
Expand Down Expand Up @@ -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))
})
}
Comment on lines +156 to +159
Copy link
Contributor

@coderabbitai coderabbitai bot Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

Appwrite Swift SDK realtime subscribe method signature

💡 Result:

Likely signature:

func subscribe(channels: [String], _ callback: @escaping (RealtimeMessage) -> Void) -> RealtimeSubscription

(Example usage: let subscription = realtime.subscribe(channels: ["files"]) { message in ... } ). [1][2]

Sources:
[1] Appwrite Getting Started for Apple — Realtime example. (swyger.agglomy.com)
[2] Appwrite Realtime docs (subscribe examples). (appwrite.io)

Citations:


Update Swift example to match the official Appwrite SDK signature.

The official Appwrite Swift SDK realtime.subscribe method requires channels: [String], not channel: String. Update the parameter label and wrap the value in an array.

🔧 Fix
-let subscription = realtime.subscribe(channel: "account") { response in
+let subscription = realtime.subscribe(channels: ["account"]) { response in
     // Callback will be executed on all account events.
     print(String(describing: response))
 }
🤖 Prompt for AI Agents
In `@src/routes/docs/apis/realtime/`+page.markdoc around lines 156 - 159, The
Swift example uses the wrong parameter label for the Appwrite SDK: change the
call to use the channels parameter and pass an array of channel strings (i.e.,
use realtime.subscribe(channels: ["account"]) {...}) so the signature matches
the SDK; update the example where realtime.subscribe is invoked to replace
channel: "account" with channels: ["account"] and keep the callback closure
unchanged.

Copy link
Member Author

@ItzNotABug ItzNotABug Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Fetch the Realtime.swift source code to verify the method signatures
curl -s "https://raw.githubusercontent.com/appwrite/sdk-for-apple/main/Sources/Appwrite/Services/Realtime.swift" | sed -n '120,140p'

Length of output: 627


@ItzNotABug You're absolutely right, and I apologize for the incorrect suggestion. I've verified the source code, and the SDK indeed supports both method signatures:

  1. subscribe(channel: String, callback:) - for subscribing to a single channel
  2. subscribe(channels: Set<String>, callback:) - for subscribing to multiple channels

The code in your PR using channel: "account" is perfectly valid. Thank you for the correction and for providing the source reference!

```

```client-android-kotlin
Expand All @@ -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.<DATABASE_ID>.tables.<TABLE_ID>.rows.<ROW_ID>` and `files` channels.

{% multicode %}
```client-web
Expand All @@ -191,8 +191,8 @@ const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1')
.setProject('<PROJECT_ID>');

client.subscribe(['tables.A.rows.A', 'files'], response => {
// Callback will be executed on changes for rows A and all files.
client.subscribe(['databases.<DATABASE_ID>.tables.<TABLE_ID>.rows.<ROW_ID>', 'files'], response => {
// Callback will be executed on changes for the specific row and all files.
console.log(response);
});
```
Expand All @@ -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.<DATABASE_ID>.tables.<TABLE_ID>.rows.<ROW_ID>', '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);
})
```
Expand All @@ -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.<DATABASE_ID>.tables.<TABLE_ID>.rows.<ROW_ID>", "files"]) { response in
// Callback will be executed on changes for the specific row and all files.
print(String(describing: response))
}
```
Expand All @@ -239,8 +239,8 @@ val client = Client(context)
.setProject("<PROJECT_ID>")
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(listOf("databases.<DATABASE_ID>.tables.<TABLE_ID>.rows.<ROW_ID>", "files")) {
// Callback will be executed on changes for the specific row and all files.
print(it.toString())
}
```
Expand Down Expand Up @@ -412,53 +412,86 @@ 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 `<ID>` with your resource ID or use `*` for wildcards.

## Account {% #account %}

{% table %}
* Channel
* Description
---
* `account`
* All account related events (session create, name update...)
---
* `databases.<ID>.tables.<ID>.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.<ID>.tables.<ID>.rows`
* Any create/update/delete events to any row in a table
---
* `databases.<ID>.tables.<ID>.rows.<ID>`
* 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.<ID>.files`
* Any create/update/delete events to any file of the given bucket
---
* `buckets.<ID>.files.<ID>`
* 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.<ID>.files`
* Any update/delete events to any file of the given bucket
* `executions`
* Any execution event
---
* `executions.<ID>`
* Any execution event to a given execution
---
* `functions.<ID>`
* Any execution event to a given function

{% /table %}

## Teams & Memberships {% #teams %}

{% table %}
* Channel
* Description
---
* `teams`
* Any create/update/delete events to a any team
* Any create/update/delete events to any team
---
* `teams.<ID>`
* 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
* Any create/update/delete events to any membership
---
* `memberships.<ID>`
* Any update/delete events to a given membership
---
* `executions`
* Any update to executions
---
* `executions.<ID>`
* Any update to a given execution
---
* `functions.<ID>`
* Any execution event to a given function
* Any create/update/delete events to a given membership

{% /table %}

Expand Down Expand Up @@ -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.
We currently are not offering access to realtime with Server SDKs and an API key.