Hello I’m new here so hi again 👋 I’m trying to use realtime to check if new content created or content deleted in the db live.
I used : realtime.subscribe {response in print(response.events)} and I don’t understand why it’s events and not event I checked if it’s end with update/create/delete and I’m checking only events.first! I’m missing data with my approach?
It throws an event each time it changes. First request you will need to get data manually like no real-time data. After that, such method will be triggered with the corresponding data
Thank you for your answer! I have method triggered each time on the first event of the events array it’s working but I’m not pretty sure I did it right so When the subscription is triggered live with delete/update/create… its create array of events for example like that :
{ "events": [ "databases.default.collections.movies.documents.lion-king.create", "databases..collections..documents..create", "databases.default.collections..documents.lion-king.create", "databases..collections..documents.lion-king.create", "databases..collections.movies.documents.lion-king.create", "databases.default.collections.movies.documents..create", "databases..collections.movies.documents..create", "databases.default.collections..documents..create", "databases.default.collections.movies.documents.lion-king", "databases..collections..documents.", "databases.default.collections..documents.lion-king", "databases..collections..documents.lion-king", "databases..collections.movies.documents.lion-king", "databases.default.collections.movies.documents.", "databases..collections.movies.documents.", "databases.default.collections..documents.", "databases.default.collections.movies", "databases..collections.", "databases.default.collections.", "databases..collections.movies", "databases.default", "databases.*" ] }
And my code read only the first one events.first and find out what the last 6 digits are and fire the right method for it That’s good or bad?
If you don't need everything it will be better to discard the other events and only get latest
Got it solved thanks !
[SOLVED] RealTime subscription
Recommended threads
- Got message for auto payment of 15usd fo...
how did this happen? 1. i claimed my 50usd credits via jsm hackathon - https://hackathon.jsmastery.pro/ 2. it asked me which org. to apply the credits on, i se...
- Apple OAuth Scopes
Hi Hi, I've configured sign in with apple and this is the response i'm getting from apple once i've signed in. I cant find anywhere I set scopes. I remember se...
- Sign In With Apple OAuth Help
Hi All! I've got a flutter & appwrite app which Im trying to use sign in with apple for. I already have sign in with google working and the function is the sam...