Hey I am fetching all the documents from appwrite database but the problem is that i want to fetch them in a real time. For example if a user post then that post visible in ui only after i refresh the page. So I want to see the real time update in ui. So how can I fetch data in real time like snapshot in firebase ?
read this https://appwrite.io/docs/realtime
@conqueror I don't find such function in docs. can you give me the reference to that function that fetch data in real time ?
which function you are talking about
are you using flutter ?
That's help me to fetch data in real time like snapshot in firebase. I am using nextjs.
You can use Appwrite's Realtime feature for this.
As mentioned by @conqueror
You can subscribe to the databases.*.collections.*.documents.*.create event. This will send you the data of the created document, as soon as it is created.
All possible events are listed here: https://appwrite.io/docs/events
Should I have to use listdocument method to fetch ?
Please go through the docs for Realtime, and you'll know what to do 😄
if you want more then one then go for it
just use this and you are good to go ```import { Client } from "appwrite";
const client = new Client() .setEndpoint('https://cloud.appwrite.io/v1') .setProject('[PROJECT_ID]');
// Subscribe to files channel client.subscribe('files', response => { if(response.events.includes('buckets..files..create')) { // Log when a new file is uploaded console.log(response.payload); } });```
@conqueror, please don't cross-post questions in other threads. It's best to wait.
ok
Recommended threads
- 1:1 relationship doesn’t sync after re-a...
Hi, I’m trying to use a two-way one-to-one relationship. It works fine when I create a record with the relationship set, and it also works when I unset it. But ...
- Failed to create function
Hey everyone 👋 I'm having an issue creating Functions on Appwrite Cloud and I'm not sure if it's a platform bug or something wrong in my project. When I try t...
- Upsert with setting permissions
Hi there, I am using self-hosted appwrite v1.7.4 and trying to use the bulk update stuff that was released with 1.7.x. Unfortunally I found that there is an ser...