The WebSocket connection was failing for two reasons:
- ❌ Missing
/wspath - The UI was connecting tows://localhost:3000/?email=...instead ofws://localhost:3000/ws?email=... ⚠️ No device connected - The server shows "No systems available" because no device has connected yet
✅ Updated src/pages/dashboard/Dashboard.jsx to include the /ws path in the WebSocket URL.
You need to start things in the correct order:
Open 3 terminals and run these commands:
# Terminal 1: Start the server
node server/fastify-server.js
# Terminal 2: Start the telemetry sender (simulates a device)
node server/send-sample-telemetry.js
# Terminal 3: Start the frontend
npm run devThen open your browser to the frontend URL (usually http://localhost:5173).
Step 1: Start the Server
node server/fastify-server.jsWait for: Server is running on port 3000
Step 2: Start the Telemetry Sender
node server/send-sample-telemetry.jsWait for: ✓ Connected to server and ✓ All messages sent
Step 3: Start the Frontend
npm run devStep 4: Open Browser
- Navigate to the frontend URL (e.g., http://localhost:5173)
- Log in if needed
- The dashboard should now connect and display data
[New WebSocket Connection]
Connection Query Params: { systemToWatch: 'TEST-SYSTEM-001', url: '/ws?...' }
✓ Device connected
✓ UI client connected
[Connecting to WebSocket]: ws://localhost:3000/ws?email=...
[WebSocket Connected]
- Heart Rate: 100 bpm
- Left Cardiac Output: ~80 L/min
- Right Cardiac Output: ~8.5 L/min
- Temperature: 43.0°C
- Voltage: 16.9V
- CPU Load: 20%
- Accelerometer: 1.40g
- Charts updating in real-time
Cause: No device is connected
Fix: Make sure send-sample-telemetry.js is running
Cause: Server not running or wrong URL Fix:
- Verify server is running on port 3000
- Check the WebSocket URL in browser console
- Should be
ws://localhost:3000/ws?email=...(note the/ws)
Cause: Server error or port conflict Fix: Check server logs for errors
Cause: Telemetry sender not running
Fix: Start send-sample-telemetry.js
Once everything is running, verify:
- WebSocket connects successfully (check browser console)
- Heart rate displays: 100 bpm
- Cardiac output displays for both sides
- System Health section shows all 4 metrics
- Charts update in real-time
- No errors in browser console
- No errors in server logs
If you want to verify everything works without the UI, run:
# Terminal 1: Start server
node server/fastify-server.js
# Terminal 2: Run automated test
node server/test-ui-connection.jsThis will verify the server is working correctly.
The fix has been applied to Dashboard.jsx. Now when you:
- Start the server
- Start the telemetry sender
- Start the frontend
Everything should connect properly and you'll see live telemetry data in the dashboard!