Back

How to subscribe pref for realtime

  • 0
  • Flutter
conqueror
25 May, 2023, 19:10

How to subscribe pref for realtime update

TL;DR
To subscribe to real-time updates for user preferences, follow these steps: 1. Subscribe to the `account` channel. 2. Create a new post and include your code in the designated channel. 3. Ensure that you are using `account` as the channel, as suggested by Jyoti. 4. Check if the `payload.events[0]` includes the string `'prefs.update'` to ensure that the update appears in real-time. If the update is not triggering when updating preferences, make sure you are using the correct syntax, such as `users.*.update.*.prefs`. If you have any further questions or need
joeyouss
25 May, 2023, 19:47

Hi - I do not understand your question completely but do you want to know how to subscribe to changes to user preferences using realtime?

You can use realtime ( https://appwrite.io/docs/realtime ) and subscribe to channel account.

Then, when you get the payload, you check events. There, the first event is the most specific one. So you could do if statement like payload.events[0].includes('prefs.update')

joeyouss
25 May, 2023, 19:47

Feel free to correct me if I understood the question wrong

conqueror
25 May, 2023, 20:02

using this users.*.update.*.prefs ?

conqueror
25 May, 2023, 20:03

but this is not triggering when i am trying to update prefs.

conqueror
25 May, 2023, 20:09

have you got my point?

Lawrence franklin
4 Jun, 2023, 16:45

Hi @joeyouss. So when you check for the payload.events[0].includes(‘prefs.update’) What do I do to make sure that the update appears in real time?

Drake
4 Jun, 2023, 21:12

Are you using account as the channel just like Jyoti recommended?

Drake
4 Jun, 2023, 21:12

Please create a new <#1072905050399191082> post and include your code

conqueror
4 Jun, 2023, 21:21

just subscribe account channel and you are good to go.

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