Back

Realtime and relationships

  • 0
  • Self Hosted
  • Web
fmmmmmz
24 Oct, 2024, 16:31

Hi! I'm testing the realtime in web, and it works flawlessly. I call for an specific ID in the collection, so the document is the only thing I'm subscribing at, but the relationships defined in the DB are not present in that change, nor does it triggers the change when the a related entry gets created or updated. Is this expected? or is there a way to configure this differently? I could not find any docs about this particular topic.

TypeScript
export const subscribe = async (collection: string, document: string) => {
  const unsubscribe = await client.subscribe(
    `databases.${
      DBID as any
    }.collections.${collection}.documents.${document}`,
    (response) => {
      console.log('hello', response);
    }
  );
  return unsubscribe;
};

In the payload Im expecting the object.
{ ...myData, messages (the relationship) } But only get { ...myData }

Thanks in advance!

TL;DR
Developers are using realtime subscription in the web successfully, but are not receiving changes to related entries in the database when subscribing to a specific document. The code seems to be missing a way to handle relationships in the subscription. Solution: To include related entries in your realtime subscription, consider restructuring the code to include logic that captures changes to related documents in the database.
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