How to filter on the Supabase v2 subscriptions ?
Hi,
The goal is to have a subscription that filters for only that user's images.
This was the code in Supabase v1 that worked.
However, this new code now fails at filtering:
Could someone please tell me the correct syntax now to do this?
The goal is to have a subscription that filters for only that user's images.
This was the code in Supabase v1 that worked.
supabaseSubscription = supabase
.from(images:profile_id=eq.${profileId})
.on('INSERT', (payload) => {
outputPictureURL = payload['new']['image'];
});
clearTimeout(timeoutId);
})
.subscribe();However, this new code now fails at filtering:
supabaseSubscription = supabase
.channel(public:images:profile_id=eq.${profileId})
.on(
'postgres_changes',
{ event: 'INSERT', schema: 'public', table: 'images' },
(payload) => {
console.log('payload is: ', payload);
outputPictureURL = payload['new']['image'];
});
clearTimeout(timeoutId);
}
)
.subscribe();Could someone please tell me the correct syntax now to do this?