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-1/

Chat Room Presence Tracker

Context

You are building a chat application using PubNub. Users join and leave chat rooms, and the application needs to display an accurate list of who is currently online in a given room. The system must handle all edge cases: users who disconnect cleanly, users whose connections drop unexpectedly, users who update their status metadata, and rooms with very large numbers of participants where PubNub changes how it reports presence.

When the application first loads or reconnects, it needs to know who is already in the room -- it cannot rely solely on real-time events since it may have missed past events.

Task

Implement a JavaScript class called PresenceManager that:

  1. Accepts a PubNub instance and a channel name in the constructor
  2. Maintains a real-time list of all users currently in the channel
  3. Has an initialize() method that fetches the current state of the channel on startup
  4. Processes all types of presence events to keep the user list accurate
  5. Tracks the current occupancy count
  6. Provides methods to query the user list: getUsers(), getOccupancy(), isUserOnline(uuid)
  7. Exposes overridable callback methods that external code can set to react when users join, leave, or when the occupancy changes
  8. Handles channels that may have a very high number of concurrent users, where PubNub delivers presence data differently

Expected Outputs

A single JavaScript file presence-manager.js containing the PresenceManager class.

Install with Tessl CLI

npx tessl i guydemo/pubnub-presence@0.1.2

evals

scenario-1

rubric.json

task.md

SKILL.md

tile.json