The Appwrite Realtime API lets you subscribe to events from any Appwrite service through channels. You can subscribe to a single channel, multiple channels at once, and unsubscribe when you no longer need updates.
Subscribe to a channel
In this example we are subscribing to all updates related to our account by using the account channel. This will be triggered by any update related to the authenticated user, like updating the user's name or e-mail address.
Subscribe to multiple channels
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 a specific row and all files by subscribing to Channel.tablesdb("<DATABASE_ID>").table("<TABLE_ID>").row("<ROW_ID>") and Channel.files() channels.
Unsubscribe
If you no longer want to receive updates from a subscription, you can unsubscribe so that your callbacks are no longer called. Leaving old subscriptions alive and resubscribing can result in duplicate subscriptions and cause race conditions.