[Workshop #222] Visitor presence protocol — announce arrival and departure #41

Closed
opened 2026-03-18 21:40:33 -04:00 by perplexity · 2 comments
Owner

Epic: rockachopa/Timmy-time-dashboard#222 — The Workshop: Timmy as Presence

The Gap

Issue rockachopa/Timmy-time-dashboard#243 defines the bridge protocol with visitor_entered, visitor_left, and visitor_interaction messages. None of these are implemented. The WS client connects and subscribes to agent channels, but never announces that a visitor has arrived.

Timmy cannot "notice the door open" if nobody tells him the door opened.

What

Implement the visitor lifecycle messages in websocket.js so the backend knows when a human enters and leaves the Workshop.

Acceptance Criteria

  • On WS connect (after subscribe): send {type: "visitor_entered", device: "ipad|desktop|mobile", viewport: {w, h}, timestamp: ...}
  • Device detection: use navigator.userAgent + touch capability to classify as ipad/desktop/mobile
  • On beforeunload or visibilitychange (hidden for >30s): send {type: "visitor_left", duration_seconds: N, timestamp: ...}
  • On reconnect after visibility restore: send visitor_entered again (Timmy sees them return)
  • Track session duration internally for the visitor_left payload
  • In mock mode: log visitor events to console but don't send (no WS)

Design Notes

This is the Workshop's "doorbell." When Timmy's sensory loop (#239) processes these events, he can greet visitors, react to their return, notice how long they stayed.

Depends on: config.js + websocket-live.js (PR #39)
Ref: rockachopa/Timmy-time-dashboard#243 (bridge protocol), #239 (sensory loop)

## Epic: rockachopa/Timmy-time-dashboard#222 — The Workshop: Timmy as Presence ### The Gap Issue rockachopa/Timmy-time-dashboard#243 defines the bridge protocol with `visitor_entered`, `visitor_left`, and `visitor_interaction` messages. None of these are implemented. The WS client connects and subscribes to agent channels, but never announces that a visitor has arrived. Timmy cannot "notice the door open" if nobody tells him the door opened. ### What Implement the visitor lifecycle messages in `websocket.js` so the backend knows when a human enters and leaves the Workshop. ### Acceptance Criteria - [ ] On WS connect (after subscribe): send `{type: "visitor_entered", device: "ipad|desktop|mobile", viewport: {w, h}, timestamp: ...}` - [ ] Device detection: use `navigator.userAgent` + touch capability to classify as ipad/desktop/mobile - [ ] On `beforeunload` or `visibilitychange` (hidden for >30s): send `{type: "visitor_left", duration_seconds: N, timestamp: ...}` - [ ] On reconnect after visibility restore: send `visitor_entered` again (Timmy sees them return) - [ ] Track session duration internally for the `visitor_left` payload - [ ] In mock mode: log visitor events to console but don't send (no WS) ### Design Notes This is the Workshop's "doorbell." When Timmy's sensory loop (#239) processes these events, he can greet visitors, react to their return, notice how long they stayed. Depends on: config.js + websocket-live.js (PR #39) Ref: rockachopa/Timmy-time-dashboard#243 (bridge protocol), #239 (sensory loop)
Author
Owner

Implemented in PR #46.

visitor.js handles the full visitor lifecycle:

  • visitor_entered sent 1.5s after load (lets WS connect first) with device type (ipad/desktop/mobile) and viewport dimensions
  • visitor_left sent on beforeunload or after 30s hidden (visibilitychange — handles iPad Safari tab suspend)
  • On return from hidden: re-announces entry so Timmy sees the visitor come back
  • Session duration tracked and included in visitor_left payload
  • sendVisitorInteraction() exported for future tap-to-interact (#44)
Implemented in PR #46. `visitor.js` handles the full visitor lifecycle: - `visitor_entered` sent 1.5s after load (lets WS connect first) with device type (ipad/desktop/mobile) and viewport dimensions - `visitor_left` sent on `beforeunload` or after 30s hidden (`visibilitychange` — handles iPad Safari tab suspend) - On return from hidden: re-announces entry so Timmy sees the visitor come back - Session duration tracked and included in `visitor_left` payload - `sendVisitorInteraction()` exported for future tap-to-interact (#44)
Author
Owner

Resolved on main — visitor.js implements visitor_entered, visitor_left, and visitor_message events with device detection, viewport reporting, visibility change handling, and session duration tracking.

Resolved on main — `visitor.js` implements `visitor_entered`, `visitor_left`, and `visitor_message` events with device detection, viewport reporting, visibility change handling, and session duration tracking.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: perplexity/the-matrix#41