Without calling subscribe(), the channel does not connect and receive events.
Step 2: Confirm event and method correctness
'presence' event and presenceState() are correct, so missing subscribe() is the issue.
Final Answer:
You forgot to call subscribe() on the channel -> Option B
Quick Check:
Must call subscribe() to receive events [OK]
Hint: Always call subscribe() after setting up channel listeners [OK]
Common Mistakes:
Skipping subscribe() call
Using wrong event name
Expecting presenceState() without subscription
5. You want to show a live list of online users with their usernames using Supabase presence. Which approach correctly combines presence tracking and user data fetching?
hard
A. Subscribe to 'update' events and update UI without querying user data
B. Query user profiles once on page load, then listen to 'message' events for updates
C. Listen to 'presence' event, get user IDs from presenceState(), then query user profiles from database
D. Use presenceState() to get usernames directly without extra queries
Solution
Step 1: Understand presenceState() data
presenceState() gives user IDs and metadata, but not full usernames.
Step 2: Combine presence with database queries
After getting IDs from presenceState(), query the database to fetch usernames for display.
Final Answer:
Listen to 'presence' event, get user IDs from presenceState(), then query user profiles from database -> Option C
Quick Check:
Presence + DB query = live usernames [OK]
Hint: Use presenceState() IDs then query DB for usernames [OK]
Common Mistakes:
Expecting presenceState() to contain usernames
Not querying user profiles after presence update
Listening to wrong events like 'message' or 'update'
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.