Hi all, I am trying to listen to real-time supabase updates in my react-native app, but for some reason no matter what I do I can't get it to work. I have set up replication under supabase_realtime for all my tables last night because I noticed it wasn't enabled for all tables, thinking this would fix it. Real-time update listening is still not working unfortunately. When I print the status it says "CLOSED" by the way. I also don't have RLS enabled on my tables. Here is the code in my useEffect hook:
useEffect(() => {
const messageSubscription = supabaseClient
.from('\*')
.on("\*", (payload) => { console.log("GOT HERE") } )
.subscribe((status) => { console.log(status) });
return () => {
supabaseClient.removeSubscription(messageSubscription);
};
}
}, []);
Would appreciate any help, been stuck for a long time 😦. Real-time listening appears to only work when the code is outide of useEffect, but this would mean it makes hundreds of subscriptions (I think) which is unsustainable of course.