
"use client";
import { useEffect } from "react"; import { getSessionCookie } from "@/actions/auth"; import { createBrowserSessionClient } from "@/lib/appwrite-browser";
export default function Orders() { useEffect(() => { const startRealtime = async () => { const session = await getSessionCookie();
if (!session) return;
const { client } = createBrowserSessionClient(session);
const unsubscribe = client.subscribe(
`databases.${process.env
.NEXT_PUBLIC_APPWRITE_DATABASE!}.collections.${process.env
.NEXT_PUBLIC_APPWRITE_COLLECTION_ORDERS!}.documents`,
(response) => {
console.log(response);
}
);
return () => {
unsubscribe();
};
};
startRealtime();
}, []);
return <div></div>; }
Dev stack: Next.js I now need to set the collections permissions to anyone who can access them in order to receive real time. I am sure that the session I passed in is correct.

What is the exact error you get.

You also don't have to set permissions to any for people to get realtime data. Realtime works based on user permissions.
Recommended threads
- Prevent modifying specific attributes
How do I prevent user to only to be able to modify some of the attributes. Document level security gives full access to update whole document, what are the wor...
- Bypass Error When Creating Account With ...
Suppose user first uses email/pass for log in using xyz@gmail.com, few month later on decides to use google oauth2 with same xyz@gmail.com (or in reverse orde...
- No mails from Appwrite
Hello, Since severals days, i have a problem : i d'ont received any mails from Appwrite. I'm using the auth by mail and i don't any code so any mails from App...
