room_id with the value 42.messages table.room_id equals the variable room_id.subscription.room_id with the value 42.messages table.room_id equals the variable room_id.subscription.room_id variableroom_id and set it to the number 42.Use const room_id = 42; to create the variable.
messages table using supabase. Assign the subscription to a variable called subscription. Do not add filters yet.Use supabase.channel('public:messages').on('postgres_changes', ...).subscribe().
room_idroom_id equals the variable room_id. Use the filter property in the on method options.Add filter: `room_id=eq.${room_id}` inside the on method options.
.subscribe() and assigned to the variable subscription. The subscription should listen only to new messages with room_id equal to 42.Make sure .subscribe() is called and the result is assigned to subscription.
What is the main purpose of using realtime filters in Supabase?
Which of the following is the correct syntax to filter realtime updates for rows where status equals 'active'?
supabase.from('tasks').on('INSERT', callback).filter(...)Given the code below, what data will the callback receive?
supabase
.from('messages')
.on('UPDATE', payload => console.log(payload.new))
.match({room_id: 5})
.subscribe()What is wrong with this Supabase realtime subscription code?
const subscription = supabase
.from('orders')
.on('INSERT', payload => console.log(payload))
.match({status: 'pending'})
.subscribe()
// Later in code
subscription.unsubscribe()You want to listen to realtime updates for tasks where priority is either 'high' or 'urgent'. Which approach correctly sets up this filter?
Pass the test and this pattern moves unknown