Skip to content
Back

[SOLVED] how to choose a realtime database for a specific user by user id

  • 0
  • Flutter
  • Web
Wiseman
16 Dec, 2024, 19:13

how to implement this

TL;DR
[Solution]: Subscribe to document update events and check for ones where document.userId == userId to choose a realtime database for a specific user by user ID. In code: ```final realtime = Realtime(client).subscribe([ 'databases.your_database_id.collections.user_subscriptions.documents.userId' ]);```
Kenny
16 Dec, 2024, 19:14

Not sure I follow what you're asking for

Kenny
16 Dec, 2024, 19:15

You want a realtime connection to a database and for it to follow user permissions?

Wiseman
16 Dec, 2024, 19:15
TypeScript
  'databases.your_database_id.collections.user_subscriptions.documents.userId'
]);```  i  want to subscribe a channel using user id something like this
Kenny
16 Dec, 2024, 19:17

That's not something you can do, you can subscribe to document update events and check for ones where document.userId == userId

Wiseman
16 Dec, 2024, 19:23

ok, that means event will only trigger for perticular user if document secuty is enable right ?

Kenny
16 Dec, 2024, 19:24

Correct

Wiseman
16 Dec, 2024, 19:28

thanks

Kenny
16 Dec, 2024, 19:52

[SOLVED] how to choose a realtime database for a specific user by user id

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