Appwrite supports multiple protocols for accessing the server, including REST, GraphQL, and Realtime. The Appwrite Realtime allows you to listen to any Appwrite events in realtime using the Realtime service.
Instead of requesting new data via HTTP, the subscription will receive new data every time it changes, any connected client receives that update within milliseconds via a WebSocket connection.
This lets you build an interactive and responsive user experience by providing information from all of Appwrite's services in realtime. The example below shows subscribing to realtime events for file uploads.
To subscribe to updates from different Appwrite resources, you need to specify one or more channels. The channels offer a wide and powerful selection that will allow you to listen to all possible resources. This allows you to receive updates not only from the database, but from all the services that Appwrite offers.
If you subscribe to a channel, you will receive callbacks for a variety of events related to the channel. The events column in the callback can be used to filter and respond to specific events in a channel.
View a list of all available events.
Permissions
All subscriptions are secured by the permissions system offered by Appwrite, meaning a user will only receive updates to resources they have permission to access.
Using Role.any() on read permissions will allow any client to receive updates.
Limitations
While the Realtime API offers robust capabilities, there are currently some limitations to keep in mind.
Subscription changes
The SDK creates a single WebSocket connection for all subscribed channels. Each time a channel is added or unsubscribed, the SDK currently creates a completely new connection and terminates the old one.
Therefore, subscriptions to channels should always be managed alongside your application state so they are not unnecessarily recreated during component lifecycle changes.
Server SDKs
We currently are not offering access to realtime with Server SDKs and an API key.