Complete the code to subscribe to changes on the 'messages' table.
const subscription = supabase.from('messages').on('INSERT', payload => { console.log('New message:', [1]); }).subscribe();
The payload.new contains the new row data after an INSERT event.
Complete the code to listen for UPDATE events on the 'profiles' table.
const subscription = supabase.from('profiles').on('[1]', payload => { console.log('Profile updated:', payload.new); }).subscribe();
The event type for updates is UPDATE.
Fix the error in the subscription code to correctly unsubscribe.
subscription.[1]();The correct method to stop listening is unsubscribe().
Fill both blanks to subscribe to DELETE events on 'orders' and log the old data.
const subscription = supabase.from('orders').on('[1]', payload => { console.log('Deleted order:', payload.[2]); }).subscribe();
For DELETE events, the old row data is in payload.old.
Fill all three blanks to subscribe to all changes on 'tasks' and log the event type and new data.
const subscription = supabase.from('tasks').on('[1]', payload => { console.log('Event:', payload.[2]); console.log('Data:', payload.[3]); }).subscribe();
Using * subscribes to all event types. The event type is in payload.eventType and new data in payload.new.
