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.
Can you share the code in which you're subscribing?
please.format your code with 3 ` in the start and end. makes it easier to read @Fatih YILMAZ
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
Can you change database to plural databases?
return _realtime.subscribe(
[
'databases.${AppwriteConstants.databaseId}.collections.${AppwriteConstants.chatCollection}.documents',
],
).stream;
And try again?
now working thanks
You can mark the title as [Solved]
[SOLVED] Unable to receive updates via Realtime
Recommended threads
- Flutter OAuth2 webAuth Bug?
I created with flutter an app where I can login in with my Microsoft Account. When I compile it to Web (WASM) or Android (aab) then there is no problem what so ...
- Synchronous Function Execution Timed Out...
Hi Appwrite team 👋 I’m facing a synchronous function execution timeout issue on Appwrite Cloud and would appreciate some guidance. I executed this function u...
- Push Notification FCM Error
Hello dear people. I tried to integrate Push Notifications into my Flutter App. Everything works fine on Android/iOS Simulator + Testflight but as soon as I s...