Skip to content
Back

[SOLVED] Unable to receive updates via Realtime

  • 0
  • Flutter
Fatih YILMAZ
19 May, 2023, 08:47

I subscribed this channel 'database.${AppwriteConstants.databaseId}.collections.${AppwriteConstants.chatCollection}.documents' my view code is ref.watch(getLatestMessageProvider).when( data: (realtime) { if (realtime.events.contains( 'database..collections.${AppwriteConstants.chatCollection}.documents..create')) { print("new data"); //print(realtime.payload); //print(realtime.channels); } else { print("else"); } return const Text("data"); }, error: (error, stackTrace) { return const Center(child: Text("Error")); }, loading: () { return const Center( child: Text("Loading..."), ); }, ), but i can only see in the console subscription: wss://cloud.appwrite.io/v1/realtime?project=645232c7e57e4706fb05&channels%5B%5D=database.645232d4e83ca767613c.collections.645fcdb238ee745038bb.documents and nothing happening when i create new document.

TL;DR
The user was experiencing an issue where they were unable to receive updates via Realtime. They were advised to change 'database' to plural 'databases' in their code. After making this change, they confirmed that the issue was resolved. The code snippet provided shows their subscription and the UI section where they handle the updates.
Binyamin
19 May, 2023, 12:40

Can you share the code in which you're subscribing?

safwan
19 May, 2023, 12:55

please.format your code with 3 ` in the start and end. makes it easier to read @Fatih YILMAZ

Fatih YILMAZ
19 May, 2023, 13:11

Stream<RealtimeMessage> getLiveMessages() { return _realtime.subscribe( [ 'database.${AppwriteConstants.databaseId}.collections.${AppwriteConstants.chatCollection}.documents', ], ).stream; } //subscribtion ref.watch(getLatestMessageProvider).when( data: (realtime) { if (realtime.events.contains( 'database..collections.${AppwriteConstants.chatCollection}.documents..create')) { print("new data"); //print(realtime.payload); //print(realtime.channels); } else { print("else"); } return const Text("data"); }, error: (error, stackTrace) { return const Center(child: Text("Error")); },// that's ui section @Binyamin

Binyamin
19 May, 2023, 13:19

Can you change database to plural databases?

TypeScript
    return _realtime.subscribe(
     [
        'databases.${AppwriteConstants.databaseId}.collections.${AppwriteConstants.chatCollection}.documents',
      ],
    ).stream;
Binyamin
19 May, 2023, 13:19

And try again?

Fatih YILMAZ
19 May, 2023, 13:54

now working thanks

Binyamin
19 May, 2023, 13:54

You can mark the title as [Solved]

safwan
19 May, 2023, 14:05

[SOLVED] Unable to receive updates via Realtime

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