Skip to content

Conversation

@ArnabChatterjee20k
Copy link
Contributor

@ArnabChatterjee20k ArnabChatterjee20k commented Jan 23, 2026

What does this PR do?

(Provide a description of what this PR does.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

Summary by CodeRabbit

  • Documentation
    • Updated Realtime API documentation to introduce Channel helper methods for building channel strings across Web, Flutter, Apple, and Android SDKs.
    • Added guidance on event filtering using .create(), .update(), and .delete() methods.
    • Expanded channels reference table with Channel helper signatures and equivalent forms for common resource types.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 23, 2026

Walkthrough

This change updates documentation for real-time APIs in a Markdoc file by introducing Channel helper usage throughout code examples. It replaces raw string channel identifiers with a fluent API approach (Channel.bucket().file().toString(), Channel.account(), etc.). The update includes a new "Channel helpers" section documenting the fluent API with examples across multiple client languages (JavaScript, Flutter, Swift, Kotlin), extends existing channel tables to show helper signatures alongside raw channel IDs, and adds guidance on event filtering using .create(), .update(), and .delete() methods.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Added channel helper docs' directly reflects the main change: documentation updates for channel helpers in the realtime API page, covering new Channel helper API usage, examples, and guidance.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/routes/docs/apis/realtime/+page.markdoc (2)

60-66: Bug: Variable name mismatch in Swift example.

Line 62 references message.events!, but the closure parameter is named response. This will cause a compile error.

🐛 Proposed fix
 // Subscribe to files channel using Channel helper
 let subscription = realtime.subscribe(channels: [Channel.bucket().file().toString()]) { 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))
     }
 }

246-250: Missing semicolon in Dart example.

Dart statements should end with a semicolon. The listen() call is missing its terminating semicolon.

Proposed fix
 subscription.stream.listen((response) {
     // Callback will be executed on all account events.
     print(response);
-})
+});

Note: The same issue appears in other Flutter examples at lines 331 and 413.

🤖 Fix all issues with AI agents
In `@src/routes/docs/apis/realtime/`+page.markdoc:
- Around line 581-595: Fix the two typos in the table descriptions: change the
string "to a any team" to "to any team" for the teams entry (near the `teams` /
`Channel.team().toString()` block) and change "to a any membership" to "to any
membership" for the memberships entry (near the `memberships` /
`Channel.membership().toString()` block); update the plain text in +page.markdoc
so the descriptions read "Any create/update/delete events to any team" and "Any
create/update/delete events to any membership" respectively.
🧹 Nitpick comments (2)
src/routes/docs/apis/realtime/+page.markdoc (2)

189-194: Clarify when .toString() is required.

The documentation shows Channel.account() used directly (lines 110, 223) but chained calls like Channel.database(...).collection(...).document(...) always use .toString(). The guidance "when needed" may confuse developers.

Consider explicitly stating which helpers return strings directly versus which require .toString(), or standardize by always using .toString() for consistency.


611-617: Consider adding a code example for event filtering.

The event filtering methods (.create(), .update(), .delete()) are documented but not demonstrated in the code examples throughout the page. A brief example showing actual usage in a subscription call would help developers understand how to apply these filters.

Comment on lines 581 to 576
* `teams`
* `Channel.team().toString()`
* Any create/update/delete events to a any team
---
* `teams.[ID]`
* `Channel.team(ID).toString()`
* Any update/delete events to a given team
---
* `memberships`
* `Channel.membership().toString()`
* Any create/update/delete events to a any membership
---
* `memberships.[ID]`
* `Channel.membership(ID).toString()`
* Any update/delete events to a given membership
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Typos in table descriptions.

  • Line 583: "to a any team" → "to any team"
  • Line 591: "to a any membership" → "to any membership"
Proposed fix
 * `teams`
 * `Channel.team().toString()`
-* Any create/update/delete events to a any team
+* Any create/update/delete events to any team
 ---
 * `teams.[ID]`
 * `Channel.team(ID).toString()`
 * Any update/delete events to a given team
 ---
 * `memberships`
 * `Channel.membership().toString()`
-* Any create/update/delete events to a any membership
+* Any create/update/delete events to any membership
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* `teams`
* `Channel.team().toString()`
* Any create/update/delete events to a any team
---
* `teams.[ID]`
* `Channel.team(ID).toString()`
* Any update/delete events to a given team
---
* `memberships`
* `Channel.membership().toString()`
* Any create/update/delete events to a any membership
---
* `memberships.[ID]`
* `Channel.membership(ID).toString()`
* Any update/delete events to a given membership
* `teams`
* `Channel.team().toString()`
* Any create/update/delete events to any team
---
* `teams.[ID]`
* `Channel.team(ID).toString()`
* Any update/delete events to a given team
---
* `memberships`
* `Channel.membership().toString()`
* Any create/update/delete events to any membership
---
* `memberships.[ID]`
* `Channel.membership(ID).toString()`
* Any update/delete events to a given membership
🤖 Prompt for AI Agents
In `@src/routes/docs/apis/realtime/`+page.markdoc around lines 581 - 595, Fix the
two typos in the table descriptions: change the string "to a any team" to "to
any team" for the teams entry (near the `teams` / `Channel.team().toString()`
block) and change "to a any membership" to "to any membership" for the
memberships entry (near the `memberships` / `Channel.membership().toString()`
block); update the plain text in +page.markdoc so the descriptions read "Any
create/update/delete events to any team" and "Any create/update/delete events to
any membership" respectively.


// Subscribe to files channel
client.subscribe('files', response => {
client.subscribe(Channel.bucket().file(), response => {
Copy link
Member

Choose a reason for hiding this comment

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

Should be Channel.files() here


final subscription = realtime.subscribe(['databases.<DATABASE_ID>.tables.<TABLE_ID>.rows.<ROW_ID>', 'files']);
final subscription = realtime.subscribe([
Channel.tablesdb('db1').table('table1').row('row1'),
Copy link
Member

Choose a reason for hiding this comment

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

Let's keep the placeholder values like <DATABASE_ID>

Comment on lines -353 to +465
If you subscribe to the `rows` channel and a row the user is allowed to read is updated, you will receive an object containing information about the event and the updated row.
If you subscribe to the `documents` channel and a document the user is allowed to read is updated, you will receive an object containing information about the event and the updated document.
Copy link
Member

Choose a reason for hiding this comment

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

Let's keep TablesDB scope

Comment on lines 562 to +563
* `teams`
* `Channel.team()`
Copy link
Member

Choose a reason for hiding this comment

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

The functions for these should be plural like the channel, teams -> Chanel.teams()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants