Back

issue in RealTime listening

  • 0
  • Flutter
  • Realtime
joeyouss
14 Jun, 2023, 14:47

Please mark this post as SOLVED or CLOSED if no further help is needed.

TL;DR
User is having an issue with real-time listening. They want to only get documents that contain a particular value. The solution is to remove the `.` at the end of the code. They can send all the necessary parts inside the `subscription` code block. Some code is spread across multiple files. The user is asked to share the relevant code. The user shares a code snippet. When an event is received, the document is printed. The user asks how they can look for a particular field inside the document. A code snippet is provided to subscribe to the real-time listening. User is advised to mark the post as solved if no further
Nuaiman
14 Jun, 2023, 14:54

Hi, I will once done

Nuaiman
14 Jun, 2023, 14:54

@Binyamin

Nuaiman
14 Jun, 2023, 14:55

hey, I needed some clarification

Nuaiman
14 Jun, 2023, 14:55

if you are available

joeyouss
14 Jun, 2023, 14:55

please feel free to post your doubts

Nuaiman
14 Jun, 2023, 15:03

``

Nuaiman
14 Jun, 2023, 15:03
TypeScript
   final sunscription = _realtime.subscribe([
      'databases.${AppwriteConstants.databaseId}.collections.${AppwriteConstants.chatsCollection}.documents.'
    ]);
Nuaiman
14 Jun, 2023, 15:03

hi how can I look for a particular field inside this document?

Binyamin
14 Jun, 2023, 15:06

When you get the event, you'll get the document.

Binyamin
14 Jun, 2023, 15:07
TypeScript
final realtime = Realtime(client);

final subscription = realtime.subscribe(['databases.${AppwriteConstants.databaseId}.collections.${AppwriteConstants.chatsCollection}.documents']);

subscription.stream.listen((response) {
    final doc = response.payload;
    print(doc); 
});
Nuaiman
14 Jun, 2023, 15:18

@Binyamin brother would please have a look at my project?

Binyamin
14 Jun, 2023, 15:19

What part?

Binyamin
14 Jun, 2023, 15:20

Can you share it here?

Nuaiman
14 Jun, 2023, 15:21

3 4 file spaning files

Nuaiman
14 Jun, 2023, 15:21

i mean code is spread accress 3 4 files

Nuaiman
14 Jun, 2023, 16:23

@Binyamin

Nuaiman
14 Jun, 2023, 16:24

Nuaiman
14 Jun, 2023, 16:24

final sunscription = _realtime.subscribe([ 'databases.${AppwriteConstants.databaseId}.collections.${AppwriteConstants.chatsCollection}.documents.' ]);

Nuaiman
14 Jun, 2023, 16:24

inside of this

Binyamin
14 Jun, 2023, 16:24

You can send all thale parts

Binyamin
14 Jun, 2023, 16:24

I'll be able to check on them later

Nuaiman
14 Jun, 2023, 16:24

'databases.${AppwriteConstants.databaseId}.collections.${AppwriteConstants.chatsCollection}.documents.' I want to perforn .contains('conversationId')

Binyamin
14 Jun, 2023, 16:24

You don't need the . at the end

Nuaiman
14 Jun, 2023, 16:25

okay, but I want to only get the documents that contains a particular value

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