CtrlK
BlogDocsLog inGet started
Tessl Logo

guydemo/pubnub-presence

Implement real-time presence tracking with PubNub

79

1.07x

Quality

67%

Does it follow best practices?

Impact

98%

1.07x

Average score across 5 eval scenarios

Overview
Skills
Evals
Files

task.mdevals/scenario-3/

Multi-Device Presence Handler

Context

You are building a team collaboration application using PubNub. Users frequently access the app from multiple devices at the same time -- for example, they may have the app open on both their laptop and phone. The "Who's Online" sidebar should show each team member at most once, even if they have multiple active sessions.

When a user closes one device but keeps the other open, they should remain in the online list. They should only disappear from the list when all their sessions are gone. The application should also be able to tell the difference between a user who intentionally signed off versus one whose connection was interrupted, so it can display different status indicators.

Task

Implement a JavaScript presence event handler for PubNub that:

  1. Maintains an accurate online user list where each user appears at most once
  2. Correctly handles users who connect from multiple sessions simultaneously
  3. Only removes a user from the online list when they have no remaining active sessions
  4. Provides distinct handling for users who leave intentionally versus those who lose their connection
  5. Exposes callback methods for the UI layer to react to users coming online, going offline, or experiencing connection issues

Expected Outputs

A single JavaScript file multi-device-presence.js containing the presence handler implementation.

Install with Tessl CLI

npx tessl i guydemo/pubnub-presence

evals

SKILL.md

tile.json