Rank 3: Container
I've the below useEffect in my react (nextjs) app
useEffect(() => { const channel = `databases.${DB_ID}.collections.${CHATS_COLLECTION_ID}.documents`; const unsubscribe = client.subscribe(channel, (response) => { console.log(response); });
return () => unsubscribe(); }, []);I'm getting the client from a different file. it looks like below there
import { Client } from "appwrite";
const NEXT_PUBLIC_APPWRITE_ENDPOINT = process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT;const NEXT_PUBLIC_APPWRITE_PROJECT_ID = process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID;
const client = new Client() .setEndpoint(NEXT_PUBLIC_APPWRITE_ENDPOINT) .setProject(NEXT_PUBLIC_APPWRITE_PROJECT_ID);
export { client };But i'm getting no logs when a new document is created/updated/deleted in the corresponding collection. what am i doing wrong here?
Do the Collection permissions have anything to cause it? my collection only has the Create permission for all the users. and document level permissions enabled