Skip to content

Commit f02a256

Browse files
Merge pull request #2711 from appwrite/realtime-channel-helper
Added channel helper docs
2 parents 45e8a69 + 6e7cfa6 commit f02a256

File tree

4 files changed

+298
-81
lines changed

4 files changed

+298
-81
lines changed

.optimize-cache.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
"images/blog/announcing-new-push-notifications-features/cover.png": "a0c758cf6c8a95e09a0d2ca562b0775a50d34a4d691d675cda70e44ad21805ac",
180180
"images/blog/announcing-opt-in-relationship-loading/cover.png": "e16cc16ea6d968b29af19bcd6274741141584a7efe5e1bb18be19b77c3a380c8",
181181
"images/blog/announcing-phone-OTP-pricing/cover.png": "598d55359ca4cb2b46846a8fd76b1f051be7c5f3199b50ffa92a28e84e5f3d67",
182+
"images/blog/announcing-realtime-channel-helpers/cover.png": "cbcffde3edfb77908566ff6361cb31bb1175d64bb1958a038720c52748dfa904",
182183
"images/blog/announcing-relationship-queries/cover.png": "7e615c0a9dcbb3949d5fb7ed71f36bb44de40ae67c8cd832b96ff5bbd4b0f451",
183184
"images/blog/announcing-screenshots-api/cover.png": "56555006946b9ead5cd4258544b6a9dda44bce6841706749f7539bc31356383e",
184185
"images/blog/announcing-spatial-columns/cover.png": "b3e73629df86190fb06b715f4fe24aad473631538c1b3e78ae45cc8c5e7cd7d0",
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
layout: post
3+
title: "Announcing Realtime Channel helpers: Type-safe subscriptions made simple"
4+
description: Build realtime subscriptions faster with a fluent, chainable API that reduces errors and improves code clarity.
5+
date: 2026-02-13
6+
cover: /images/blog/announcing-realtime-channel-helpers/cover.png
7+
timeToRead: 5
8+
author: jake-barnby
9+
category: announcement
10+
featured: false
11+
---
12+
13+
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.
14+
15+
To make realtime subscriptions clearer and safer, Appwrite is introducing **Channel helpers**: a type-safe, fluent API for building realtime channel subscriptions.
16+
17+
# Type-safe channels, zero typos
18+
19+
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.
20+
21+
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.
22+
23+
# How it works
24+
25+
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.
26+
27+
Here's how you build a subscription to a specific row:
28+
29+
```javascript
30+
import { Client, Realtime, Channel } from "appwrite";
31+
32+
const client = new Client()
33+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1')
34+
.setProject('<PROJECT_ID>');
35+
36+
const realtime = new Realtime(client);
37+
38+
// Subscribe to a specific row with type-safe helpers
39+
const subscription = await realtime.subscribe(
40+
Channel.tablesdb('<DATABASE_ID>').table('<TABLE_ID>').row('<ROW_ID>'),
41+
response => {
42+
console.log(response);
43+
}
44+
);
45+
```
46+
47+
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.
48+
49+
# Flexible and composable
50+
51+
Channel helpers support the full range of Appwrite's realtime capabilities. You can:
52+
53+
- **Subscribe to all resources**: Omit IDs to use wildcards automatically
54+
- **Filter by event type**: Chain `.create()`, `.update()`, or `.delete()` to listen only to specific events
55+
- **Build complex subscriptions**: Combine multiple helpers in a single call
56+
57+
```javascript
58+
// Subscribe to all account events
59+
const subscription = await realtime.subscribe(Channel.account(), response => {
60+
console.log(response);
61+
});
62+
63+
// Subscribe to all row updates in a specific table
64+
const rowSubscription = await realtime.subscribe(
65+
Channel.tablesdb('<DATABASE_ID>').table('<TABLE_ID>').row().update(),
66+
response => {
67+
console.log('Row updated:', response.payload);
68+
}
69+
);
70+
71+
// Subscribe to multiple channels at once
72+
const multiSubscription = await realtime.subscribe([
73+
Channel.tablesdb('<DATABASE_ID>').table('<TABLE_ID>').row('<ROW_ID>'),
74+
Channel.files()
75+
], response => {
76+
console.log(response);
77+
});
78+
```
79+
80+
# Key benefits
81+
82+
- **Type-safe subscriptions**: Catch errors at compile time instead of runtime
83+
- **IDE autocomplete**: Build channels faster with intelligent suggestions
84+
- **Self-documenting code**: Channel structure is clear and readable
85+
- **Reduced errors**: Eliminate typos and formatting mistakes
86+
- **Consistent API**: Same helper syntax across all client SDKs
87+
- **Backwards compatible**: Existing string-based subscriptions continue to work
88+
89+
# Available across all platforms
90+
91+
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.
92+
93+
The helpers support all available channels, including:
94+
- Account events
95+
- Database rows
96+
- Storage files
97+
- Team and membership updates
98+
- Function executions
99+
100+
Existing subscriptions using string channels continue to work, ensuring a smooth transition for current projects.
101+
102+
# More resources
103+
104+
- [Read the documentation to get started](/docs/apis/realtime#channel-helpers)
105+
- [Learn about Realtime API events](/docs/advanced/platform/events)

0 commit comments

Comments
 (0)