Back

[SOLVED] Realtime query

  • 0
  • Flutter
  • Realtime
hortigado
19 May, 2023, 05:23

Hello, how could I get documents with a similar attribute in real time?

TL;DR
The user is asking for help with implementing a realtime query in their app. They are facing issues with the 'channel' attribute and the 'event' attribute. They suggest subscribing to an attribute and triggering a query, but the solution doesn't seem to be working. The user mentions finding an issue on GitHub but doesn't provide further details. They acknowledge that applying a filter may be necessary. The user also gives an example of wanting to see comments in real time based on a postId attribute. They ask for guidance on how to achieve this.
Drake
19 May, 2023, 05:48

What do you mean?

hortigado
19 May, 2023, 05:50

For example, I have a posts collection and I want to see the comments in real time. I save comments with the postId attribute. How do I get only the comments for that post?

Drake
19 May, 2023, 05:51

Filter client side

hortigado
19 May, 2023, 05:53

It seems that I understand, this would be done in the event property

Drake
19 May, 2023, 05:53

What do you mean?

hortigado
19 May, 2023, 06:00

subscription.stream.listen((response) { // here I would apply the filter? }

hortigado
19 May, 2023, 06:10

https://github.com/appwrite/appwrite/issues/2490 ohh I found the issue, still doesn't seem possible for now. Thanks in advance

Drake
19 May, 2023, 06:17

Use an if statement

hortigado
19 May, 2023, 06:18

Right, that's what I'm going to do for the moment for the hackathon. Thanks and regards

hortigado
19 May, 2023, 06:19

[SOLVED] Realtime query

D5
24 May, 2023, 23:07

Isn't that possible to achieve that by:

  1. Subscribing to an attribute (same attribute)
  2. Triggering a database query to get the last document with such attribute
D5
24 May, 2023, 23:09

It seems that this makes your app listen to all changes made in the database at once? (not only the ones with the attribute?)

Drake
24 May, 2023, 23:31

there is no attribute channel. plus the attribute event is an update on the collection, not the document

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more