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
- Update user email using OTP
Hi, I am trying to implement email update using OTP, there is not password associated with the account. One solution I found online is creating appwrite functio...
- RowList: The value of total is coming as...
RowList: The value of total is coming as a String, so it throws an error because it’s not parsed into an int. Error: TypeError: \"37\": type 'String' is not a ...
- [SOLVED] curl error Number: 6 — function...
Hello, I invested a lot of time in this error in a fresh install of appwrite 1.8.1 and lasted until fix, this if for helping anyone that can have the same weird...