"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
- Weird permission failure
when creating an account I use following methods: ``` Future<void> register(String email, String password, String username) async { final user = await accoun...
- Appwrite Storage error 503s for automate...
I'm facing error 503s from Appwrite after about 5-6 seconds of making AI requests from my tool with images and files above 20MB (=> not inline base64 used, but ...
- Flutter Android oAuth is no more working
I currently don't get the oAuth login to work in flutter android. it works on ios and on web. but when try to use it on Android, i get to the point where the ca...