#Realtime didn't work in react native expo.
2 messages · Page 1 of 1 (latest)
oh do we need to use the new tablesDB stuff? this is what mine looks like:
useEffect(() => {
if (!roomId) return;
// initial fetch
fetchMessages();
// subscribe for realtime updates
const unsubscribe = client.subscribe('databases.main.collections.messages.documents', response => {
console.log(response.payload);
// fetch messages again if in the same room
if (response.payload.roomId === roomId) {
fetchMessages();
}
});
return () => {
unsubscribe();
}
}, [roomId]);