useEffect(() => {
let subscription: RealtimeSubscription;
async function loadChips() {
try {
const {rows: chips} = await databases.listRows({
databaseId: appwriteConfig.databaseId,
tableId: appwriteConfig.boardsTableId
});
setChips(chips as unknown as BoardChip[]);
} catch (err) {
console.error(`Couldn't load chips: ${err}`);
} finally {
setIsLoadingChips(false);
}
}
async function realtimeSub() {
const channel = `databases.${appwriteConfig.databaseId}.tables.${appwriteConfig.boardsTableId}.rows`;
console.log(channel);
subscription = await realtime.subscribe(
channel,
(event) => {
if (event.events.some(eventName => eventName.endsWith('.create'))) {
setChips(prevChips => [...prevChips, event.payload as BoardChip]);
} else if (event.events.some(eventName => eventName.endsWith('.update'))) {
setChips(prevChips => prevChips.map(chip => chip.$id === event.payload.$id ? event.payload as BoardChip : chip));
} else if (event.events.some(eventName => eventName.endsWith('.delete'))) {
setChips(prevChips => prevChips.filter(chip => chip.$id !== event.payload.$id));
}
}
);
}
loadChips();
realtimeSub();
return () => {
subscription?.unsubscribe();
};
}, []);
for some reason in the network tab i get an error as a realtime message saying Missing Channels (code 1008). I checked and the Channel is not undefined and seems to be correct. I also tried using the new Channel-Builder to no avail :/ any ideas?
Im using self-hosted instance with 1.9.1 and latest sdk version
[SOLVED] Realtime Missing Channels
The fix is apparently using sdk version 23.0.0
Recommended threads
- Functions executed by events does not ap...
Hello, Running self-hosted Appwrite version 1.9.0 (with console 7.8.26). When functions are triggered by an event (eg. databases.\*tables.\*.rows.\*.create) doe...
- Some pages on the console are not workin...
Hello, Running self-hosted Appwrite version 1.9.0 (with console 7.8.26). I identified that some pages are not working on the console. This is at least the case ...
- THE COLUMNS STUCK ON PROCESSING HOW DO I...
I HAVE SELF HOSTED THE APPWRITE ON VPS