-
Notifications
You must be signed in to change notification settings - Fork 298
Fix: realtime api ref docs #2705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThe PR updates three areas: adds the ESLint rule disable Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/routes/docs/apis/realtime/`+page.markdoc:
- Around line 384-388: The JSON example contains a trailing comma after the last
element in the array
("databases.default.tables.sample.rows.63c98b9baea0938e1206"); remove that
trailing comma so the array ends with the final string and the next property
"timestamp" follows validly, ensuring the snippet in +page.markdoc is valid
JSON.
🧹 Nitpick comments (1)
eslint.config.js (1)
27-28: Consider adding a comment explaining why this rule is disabled.Similar to the existing comment for
no-undef, a brief explanation for disablingsvelte/no-navigation-without-resolvewould help future maintainers understand the rationale.✏️ Suggested improvement
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', + // Navigation patterns in this codebase don't require preloading with $app/navigation's preloadData/preloadCode 'svelte/no-navigation-without-resolve': 'off' }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/routes/docs/apis/realtime/`+page.markdoc:
- Around line 242-244: The example uses realtime.subscribe with multiple string
arguments but the Kotlin SDK expects a single List<String> for channels; update
the call to pass channels as a list (e.g., use listOf(...)) when calling
realtime.subscribe("token", listOf(...)) or the overload used in this doc so the
channels parameter is a List<String> (reference: realtime.subscribe and listOf
in the snippet).
🧹 Nitpick comments (1)
src/routes/docs/apis/realtime/+page.markdoc (1)
415-495: Align placeholder names in channel tables with earlier examples.The text uses
<ID>while the examples use<DATABASE_ID>,<TABLE_ID>,<ROW_ID>, etc. Consider updating the tables to match for clarity.✏️ Example consistency tweak
-* `databases.<ID>.tables.<ID>.rows` +* `databases.<DATABASE_ID>.tables.<TABLE_ID>.rows` ... -* `databases.<ID>.tables.<ID>.rows.<ID>` +* `databases.<DATABASE_ID>.tables.<TABLE_ID>.rows.<ROW_ID>` ... -* `buckets.<ID>.files` +* `buckets.<BUCKET_ID>.files` ... -* `buckets.<ID>.files.<ID>` +* `buckets.<BUCKET_ID>.files.<FILE_ID>` ... -* `executions.<ID>` +* `executions.<EXECUTION_ID>` ... -* `functions.<ID>` +* `functions.<FUNCTION_ID>` ... -* `teams.<ID>` +* `teams.<TEAM_ID>` ... -* `memberships.<ID>` +* `memberships.<MEMBERSHIP_ID>`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/routes/docs/apis/realtime/`+page.markdoc:
- Around line 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.
| let subscription = realtime.subscribe(channel: "account") { response in | ||
| // Callback will be executed on all account events. | ||
| print(String(describing: response)) | ||
| }) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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:
- 1: https://swyger.agglomy.com/docs/getting-started-for-apple.html?utm_source=openai
- 2: https://appwrite.io/docs/apis/realtime?utm_source=openai
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SDK supports both. see - https://github.com/appwrite/sdk-for-apple/blob/main/Sources/Appwrite/Services/Realtime.swift#L120C5-L140C6
There was a problem hiding this comment.
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:
subscribe(channel: String, callback:)- for subscribing to a single channelsubscribe(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!
What does this PR do?
Fixes docs for realtime with the most updated info.
Test Plan
Manual.
Related PRs and Issues
N/A.
Have you read the Contributing Guidelines on issues?
Yes.
Summary by CodeRabbit
Documentation
Chores
✏️ Tip: You can customize this high-level summary in your review settings.