Skip to content
Back

Realtime not logging response, when data is changed from the sdk

  • 0
  • Realtime
Ayomide
23 Feb, 2025, 17:53

So i am trying to use realtime in my appwrite nextjs client, i have the following code: ```ts useEffect(() => { const channel = 'databases..collections.'; console.log(channel, "About to subscribe") const unsubscribe = client.subscribe([channel], (res) => { console.log(res) if (res) { run("rooms", "GET"); // Re-fetch rooms when data changes } });

TypeScript
    return () => {
      unsubscribe(); // Cleanup function to prevent memory leaks
    };
  }, [Rooms]);``` and i don't see any log in the console of res when i update the data. I use nextjs server side for the appwrite sdk, and create API endpoints that i use to fetch and get data. so on the client side i try to use the realtime and yes i am importing from "appwrite" not "node-appwrite" here, i believe i set up everything correctly, cause after about an hour or 30 minutes i see this error in the image, so if it says realtime got disconnected it means it was connected, but the connection doesn't seem to work
TL;DR
Developers are facing an issue where realtime is not logging the response when data is changed from the SDK. The error message states that the channel being used is not valid and wildcards cannot be used for realtime channels. The code snippet provided creates a realtime subscription using Appwrite Client in a Next.js app, but the logs show no response when data is updated. This issue might be related to incorrect channel setup or data fetching. Make sure to refer to the realtime documentation for valid channels and avoid using wildcards. Additionally, double-check the implementation and connection setup for any errors.
Steven
23 Feb, 2025, 17:55

That doesn't look like a valid channel. Look at the realtime docs for valid channels. Also, you can't use wildcards for realtime channels

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