Implement real-time presence tracking with PubNub
79
Quality
67%
Does it follow best practices?
Impact
98%
1.07xAverage score across 5 eval scenarios
{
"context": "Users in a collaboration app may be logged in on both their phone and laptop simultaneously. The online user list should show each person once, not as duplicate entries. When one device disconnects, the user should remain shown as online if their other device is still connected. The UI should also indicate whether a user left intentionally or lost connection.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Device count tracking",
"description": "When a join event arrives for a UUID that is already tracked, a device/connection count is incremented rather than creating a duplicate user entry",
"max_score": 25
},
{
"name": "Count decrement on disconnect",
"description": "When a leave or timeout event arrives, the device count is decremented; the user is only removed from the online list when the count reaches zero",
"max_score": 25
},
{
"name": "Graceful leave distinction",
"description": "The code distinguishes 'leave' events (graceful disconnect) from 'timeout' events (connection lost) and provides different information or callbacks for each",
"max_score": 20
},
{
"name": "No duplicate user entries",
"description": "The user list never contains the same UUID more than once regardless of how many devices they connect from",
"max_score": 15
},
{
"name": "First join tracked",
"description": "When a UUID joins for the first time, it is added to the user map with an initial device count of 1",
"max_score": 15
}
]
}