Back

Subscribe to a specific document

  • 0
  • Self Hosted
  • Databases
  • Realtime
alon1874
29 Jan, 2024, 18:38

Hey, I'm trying to subscribe to changes on a specific document (right after its creation). After creating the record, This code doesn't get triggered: client?.subscribe(databases.aidb.collections.records.documents.${record["id"]}, response => { Calling the same flow with client?.subscribe(databases.aidb.collections.records.documents, response => { works fine. What can be the issue?

TL;DR
The developer is having trouble subscribing to changes on a specific document. The code they provided doesn't trigger the subscription after creating the record. However, subscribing to changes on the entire collection works fine. They are asking for help in identifying the issue. Solution: The issue may be with the way the document ID is being passed in the subscription code. Verify that the `record["id"]` value is correct and matches the ID of the newly created document.
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