Monorepo for Aesthetic.Computer
aesthetic.computer
1# Session Dashboard Progress Log
2
3**Date**: November 11, 2025
4
5## Overview
6Implemented a real-time status dashboard for the session server at `session-server.aesthetic.computer` that displays all connected WebSocket and UDP clients with identity tracking.
7
8## Completed Features
9
10### ✅ Status Dashboard (WORKING)
11- **URL**: https://session-server.aesthetic.computer/
12- **Features**:
13 - Real-time updates every 2 seconds via WebSocket streaming
14 - Displays WebSocket connections with user IDs and handles
15 - Displays UDP connections with user IDs and handles
16 - Auto-refreshing interface with connection counts
17 - Clean HTML interface with embedded JavaScript
18
19### ✅ Status API Endpoints (WORKING)
20- **GET `/status`**: JSON endpoint returning connection data
21 - WebSocket total count and connection details
22 - UDP total count and channel details
23 - Includes user IDs (auth0 subs) and handles
24
25- **WebSocket `/status-stream`**: Real-time streaming updates
26 - Broadcasts status updates every 2 seconds
27 - Used by dashboard for live updates
28
29### ✅ Identity Tracking Implementation (SERVER-SIDE COMPLETE)
30- **WebSocket tracking**:
31 - `users{}` map: Tracks auth0 user.sub from login messages
32 - `handles{}` map: Tracks user handles from location:broadcast messages
33 - Enhanced `getWebSocketStatus()` to include user and handle fields
34
35- **UDP tracking**:
36 - Enhanced UDP channel storage to include user and handle
37 - Added `udp:identity` message handler
38 - Enhanced `getUDPStatus()` to include user and handle fields
39
40### ✅ Client-Side Identity Code (IMPLEMENTED, NEEDS DEPLOYMENT)
41- **disk.mjs changes**:
42 - Uncommented login message sending on WebSocket connect (line 6381)
43 - Exposed `window.acHANDLE` in 3 locations for UDP access (lines 3451, 12379, 12393)
44 - Existing location:broadcast already sends handle
45
46- **udp.mjs changes**:
47 - Added `udp:identity` message emission on connection (lines 56-61)
48 - Sends both user and handle to server
49
50### ✅ WebSocket Connection Routing (WORKING)
51- Dashboard connections (`/status-stream`) handled separately
52- Game client connections tracked in `connections{}` object
53- Debug logging added for connection monitoring
54
55### ✅ Code Deployment
56- All server-side code committed and deployed to production
57- Session server running with latest code
58- Debug logging active for troubleshooting
59
60## Current Issues
61
62### 🔴 CRITICAL: WebSocket Connections Not Establishing
63**Problem**: aesthetic.computer clients establish UDP connections but NOT WebSocket connections
64
65**Evidence**:
66- Status shows: `{"total": 2, "connections": []}`
67 - `total: 2` = dashboard WebSocket connections (correct)
68 - `connections: []` = zero game client connections (BROKEN)
69- UDP shows 5 active connections with auth0 user IDs (WORKING)
70- Dashboard WebSocket connections work perfectly (proves server works)
71
72**Root Cause FOUND**:
73```javascript
74// Line 6340 in disk.mjs (BEFORE FIX)
75const monolith = undefined; // This was the problem!
76```
77
78When `monolith` is `undefined`, the session endpoint tries to use JamSocket horizontal scaling instead of connecting to session-server.aesthetic.computer.
79
80**Fix Applied** (commit 9f4ac380):
81```javascript
82// Line 6340 in disk.mjs (AFTER FIX)
83const monolith = "monolith"; // Now correctly uses session-server
84```
85
86**Status**: Code fixed and pushed to main, but aesthetic.computer site needs rebuild to deploy
87
88### ⚠️ Handles Showing as Null
89**Problem**: UDP connections show auth0 user IDs but handles are null
90
91**Root Cause**: Client-side code changes not deployed to live aesthetic.computer yet
92
93**Status**: Will be fixed once aesthetic.computer is rebuilt with updated disk.mjs and udp.mjs
94
95## Technical Architecture
96
97### Session Server Stack
98- **Framework**: Fastify v4 (HTTP/HTTPS)
99- **WebSocket**: ws library with custom routing
100- **UDP**: geckos.io for game networking
101- **Tracking**: In-memory maps (users{}, handles{}, connections{}, udpChannels{})
102
103### Identity Flow
1041. **WebSocket**:
105 - Client connects → server adds to connections{}
106 - Client sends login message → server stores user.sub in users{}
107 - Client sends location:broadcast → server stores handle in handles{}
108 - Dashboard queries → server enriches data with user/handle from maps
109
1102. **UDP**:
111 - Client connects → server creates channel
112 - Client sends udp:identity → server stores user and handle in channel object
113 - Dashboard queries → server returns enriched channel data
114
115### Deployment Architecture
116- **Production Server**: session-server.aesthetic.computer (157.245.134.225)
117- **Deployment Method**: SSH + git pull + process restart
118- **Process Management**: Direct node process (not pm2)
119- **Log Location**: /var/log/session-server.log
120
121## Next Steps
122
123### 🎯 IMMEDIATE: Rebuild aesthetic.computer
124**Required**: Deploy client-side changes to enable WebSocket connections
125
126**Changes that need to go live**:
1271. `monolith = "monolith"` (enables WebSocket to session-server) ← **CRITICAL**
1282. Login message sending (enables user ID tracking)
1293. `window.acHANDLE` exposure (enables handle tracking)
1304. UDP identity message (enables UDP handle tracking)
131
132**Once deployed, all features should work**:
133- ✅ WebSocket connections will appear in dashboard
134- ✅ Handles will populate for both WebSocket and UDP
135- ✅ User IDs will populate for both WebSocket and UDP
136- ✅ Full identity tracking operational
137
138### 📊 Validation Steps After Rebuild
1391. Open aesthetic.computer in browser
1402. Check dashboard shows WebSocket connection (not just UDP)
1413. Verify handle appears for WebSocket connection
1424. Verify handle appears for UDP connection (currently null)
1435. Verify user ID appears for both connection types
144
145## Files Modified
146
147### Server-Side (DEPLOYED)
148- `session-server/session.mjs`
149 - Added `handles{}` map (line 139)
150 - Enhanced getWebSocketStatus() with handle field (line 267)
151 - Enhanced getUDPStatus() with user/handle fields (line 282)
152 - Added login message handler (line 693)
153 - Added handle tracking in location:broadcast (line 725)
154 - Added udp:identity handler (line 1072)
155 - Added WebSocket routing logic (line 548)
156 - Added debug logging (lines 545, 569)
157 - Added dashboard HTML (lines 350-515)
158
159### Client-Side (COMMITTED, NOT DEPLOYED)
160- `system/public/aesthetic.computer/lib/disk.mjs`
161 - Changed monolith from undefined to "monolith" (line 6340) ← **CRITICAL FIX**
162 - Uncommented login message sending (line 6381)
163 - Exposed window.acHANDLE (lines 3451, 12379, 12393)
164
165- `system/public/aesthetic.computer/lib/udp.mjs`
166 - Added udp:identity message emission (lines 56-61)
167
168### Deployment Scripts
169- `session-server/deploy.fish`
170 - Updated paths from /root to /home/aesthetic-computer
171 - Changed from pm2 to direct node process management
172
173## Commits
174- 9f4ac380: Enable monolith session server for WebSocket connections (LATEST)
175- [previous]: Add more detailed WebSocket connection logging
176- [previous]: Add comprehensive identity tracking to session server
177- [previous]: Initial status dashboard implementation
178
179## Testing Results
180
181### Dashboard (✅ WORKING)
182- Loads at session-server.aesthetic.computer
183- Creates 2 WebSocket connections
184- Updates every 2 seconds
185- Displays connection data correctly
186- JSON endpoint returns valid data
187
188### UDP Connections (⚠️ PARTIAL)
189- 5 connections visible
190- Auth0 user IDs showing correctly
191- Handles showing as null (needs client rebuild)
192
193### WebSocket Connections (🔴 BROKEN, FIX READY)
194- Dashboard connections work (2 visible)
195- Game client connections not appearing (0 visible)
196- Root cause identified: monolith = undefined
197- Fix committed, needs deployment
198
199## Lessons Learned
200
2011. **Separation of concerns**: Dashboard WebSocket connections vs game client connections needed separate tracking
2022. **Deployment dependency**: Client-side changes require aesthetic.computer rebuild, not just server restart
2033. **Configuration matters**: Single variable (`monolith`) determines entire connection architecture
2044. **Independent protocols**: UDP and WebSocket are separate - one can work while other fails
2055. **Debug early**: Added logging revealed the WebSocket routing was working, connections just weren't being made