-
Notifications
You must be signed in to change notification settings - Fork 303
Added channel helper docs #2711
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
fb2bab0
updated realtime doc
ArnabChatterjee20k 8a8278e
typo
ArnabChatterjee20k 532592d
updated docs
ArnabChatterjee20k 6eae2c2
fixes
ArnabChatterjee20k c69aebc
changed the method names
ArnabChatterjee20k a8bfb14
updated
ArnabChatterjee20k 6679978
updated
ArnabChatterjee20k 971db1b
updated
ArnabChatterjee20k 6545f24
updated
ArnabChatterjee20k 97263ce
Merge branch 'main' into realtime-channel-helper
atharvadeosthale fcb8677
announcement for realtime channel helper
atharvadeosthale 136f4d9
use new realtime service for web + fixes teams -> team
atharvadeosthale 68d09f9
update announcement blog to use realtime service
atharvadeosthale a70e4b1
rabbit
atharvadeosthale 0d03940
update announcement
atharvadeosthale a03d32c
address comments
atharvadeosthale d0263cd
changes in docs and cover
atharvadeosthale 9b03921
update cover again
atharvadeosthale 1556cb9
memberships.* -> memberships
atharvadeosthale 6e7cfa6
updated teams
ArnabChatterjee20k File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
105
src/routes/blog/post/announcing-realtime-channel-helpers/+page.markdoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| --- | ||
| layout: post | ||
| title: "Announcing Realtime Channel helpers: Type-safe subscriptions made simple" | ||
| description: Build realtime subscriptions faster with a fluent, chainable API that reduces errors and improves code clarity. | ||
| date: 2026-02-13 | ||
| cover: /images/blog/announcing-realtime-channel-helpers/cover.png | ||
| timeToRead: 5 | ||
| author: jake-barnby | ||
| category: announcement | ||
| featured: false | ||
| --- | ||
|
|
||
| If you've built realtime features in your apps, you've likely written channel strings by hand: concatenating IDs, formatting wildcards, and hoping you didn't introduce a typo that would silently break your subscription. While writing channel strings like `databases.*.tables.*.rows.*` works, it's error-prone and harder to maintain as your application grows. | ||
|
|
||
| To make realtime subscriptions clearer and safer, Appwrite is introducing **Channel helpers**: a type-safe, fluent API for building realtime channel subscriptions. | ||
|
|
||
| # Type-safe channels, zero typos | ||
|
|
||
| Channel helpers eliminate the manual work of writing channel strings. Instead of concatenating strings and worrying about syntax errors, you use a chainable API that guides you through building valid channel subscriptions. | ||
|
|
||
| The helper provides IDE autocomplete, catches errors at compile time, and makes your subscription logic self-documenting. No more guessing the correct format or debugging silent subscription failures caused by a misplaced dot or asterisk. | ||
|
|
||
| # How it works | ||
|
|
||
| Channel helpers are available through the `Channel` class in all Appwrite client SDKs. The API is designed to be intuitive and mirrors the structure of your Appwrite resources. | ||
|
|
||
| Here's how you build a subscription to a specific row: | ||
|
|
||
| ```javascript | ||
| import { Client, Realtime, Channel } from "appwrite"; | ||
|
|
||
| const client = new Client() | ||
| .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') | ||
| .setProject('<PROJECT_ID>'); | ||
|
|
||
| const realtime = new Realtime(client); | ||
|
|
||
| // Subscribe to a specific row with type-safe helpers | ||
| const subscription = await realtime.subscribe( | ||
| Channel.tablesdb('<DATABASE_ID>').table('<TABLE_ID>').row('<ROW_ID>'), | ||
| response => { | ||
| console.log(response); | ||
| } | ||
| ); | ||
| ``` | ||
|
|
||
| Instead of writing `databases.<DATABASE_ID>.tables.<TABLE_ID>.rows.<ROW_ID>`, the helper builds the correct string for you while providing autocomplete and validation every step of the way. | ||
|
|
||
| # Flexible and composable | ||
|
|
||
| Channel helpers support the full range of Appwrite's realtime capabilities. You can: | ||
|
|
||
| - **Subscribe to all resources**: Omit IDs to use wildcards automatically | ||
| - **Filter by event type**: Chain `.create()`, `.update()`, or `.delete()` to listen only to specific events | ||
| - **Build complex subscriptions**: Combine multiple helpers in a single call | ||
|
|
||
| ```javascript | ||
| // Subscribe to all account events | ||
| const subscription = await realtime.subscribe(Channel.account(), response => { | ||
| console.log(response); | ||
| }); | ||
|
|
||
| // Subscribe to all row updates in a specific table | ||
| const rowSubscription = await realtime.subscribe( | ||
| Channel.tablesdb('<DATABASE_ID>').table('<TABLE_ID>').row().update(), | ||
| response => { | ||
| console.log('Row updated:', response.payload); | ||
| } | ||
| ); | ||
|
|
||
| // Subscribe to multiple channels at once | ||
| const multiSubscription = await realtime.subscribe([ | ||
| Channel.tablesdb('<DATABASE_ID>').table('<TABLE_ID>').row('<ROW_ID>'), | ||
| Channel.files() | ||
| ], response => { | ||
| console.log(response); | ||
| }); | ||
| ``` | ||
|
|
||
| # Key benefits | ||
|
|
||
| - **Type-safe subscriptions**: Catch errors at compile time instead of runtime | ||
| - **IDE autocomplete**: Build channels faster with intelligent suggestions | ||
| - **Self-documenting code**: Channel structure is clear and readable | ||
| - **Reduced errors**: Eliminate typos and formatting mistakes | ||
| - **Consistent API**: Same helper syntax across all client SDKs | ||
| - **Backwards compatible**: Existing string-based subscriptions continue to work | ||
|
|
||
| # Available across all platforms | ||
|
|
||
| Channel helpers are available in all Appwrite client SDKs: Web, Flutter, Apple, and Android. Each SDK provides the same fluent API, making it easy to build consistent realtime features across platforms. | ||
|
|
||
| The helpers support all available channels, including: | ||
| - Account events | ||
| - Database rows | ||
| - Storage files | ||
| - Team and membership updates | ||
| - Function executions | ||
|
|
||
| Existing subscriptions using string channels continue to work, ensuring a smooth transition for current projects. | ||
|
|
||
| # More resources | ||
|
|
||
| - [Read the documentation to get started](/docs/apis/realtime#channel-helpers) | ||
| - [Learn about Realtime API events](/docs/advanced/platform/events) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.