Hey, I'm currently working a nextJs projekt with appwrite and tried to connect to the 'account' channel but im not getting any response even on changes. After initial load i have opened another tab where i make changes to the user but nothing came in the page component. On the network tab there is the realtime connection pending but has no data and after a while its fail and try to esteblish a new connection.
'use client'
import React, { useEffect, useState } from 'react'
import { Client, Account } from 'appwrite';
import Connection from '@/lib/appwrite';
const Page = () => {
const client = Connection();
const account = new Account(client);
const [user, setUser] = useState<any>(null);
useEffect(() => {
const fetchUser = async () => {
try {
const userData = await account.get();
setUser(userData);
} catch (error) {
console.error('Error fetching user:', error);
}
};
fetchUser();
const unsubscribe = client.subscribe('account', (response) => {
console.log('Account update received:', response);
fetchUser();
});
return () => unsubscribe();
}, []);
return (
<div>Page asd</div>
)
}
export default Page
Recommended threads
- Missing Invoice
Hi! I need help with billing on my account (marelu@gmail.com). I have never received a single invoice by email. My organization has been on the Pro plan since...
- Appwrite Functions cold start
Hello. I'm seeing really long cold starts on Appwrite Cloud Functions and wanted to know if this is expected. My function just authenticates the user, fetches ...
- Error can not create `tablesdb` event wi...
When i'm trying to add an event with `tablesdb` i get an error message My event value: `tablesdb.mtg-decklist-dev.tables.queue_parsing.rows.*.create` Same err...