do# WebSocket & Dashboard Connectivity - Implementation Tasks
Priority: HIGH
Estimated Time: 4-6 hours
Status: Not Started
Fix WebSocket real-time updates and ensure all dashboard tabs/buttons are fully functional with proper backend connectivity.
File: scripts/proxy-client/internal/api/server.go
- Confirm
/wsendpoint is registered - Verify WebSocket upgrader configuration
- Check CORS settings allow WebSocket connections
- Add authentication to WebSocket connections
Code to verify:
router.GET("/ws", s.handleWebSocket)File: scripts/proxy-client/internal/api/server.go
- Ensure status updates broadcast to all connected clients
- Add broadcast on connect/disconnect events
- Add broadcast on IP rotation
- Add broadcast on kill switch toggle
- Add error handling for failed broadcasts
Events to broadcast:
- Connection status change
- IP rotation complete
- Location change
- Security status update
- Kill switch toggle
File: atlantic-dashboard/lib/api.ts
- Update WebSocket URL to use correct port (8765)
- Add reconnection logic (retry 3 times, 2s delay)
- Add connection state management
- Add heartbeat/ping mechanism
- Handle connection errors gracefully
Current issue:
// Change from:
this.wsUrl = baseUrl.replace('http', 'ws');
// To:
this.wsUrl = 'ws://localhost:8765';File: atlantic-dashboard/app/dashboard/page.tsx
- Re-enable
subscribeToStatus()call - Remove manual polling after actions
- Add connection status indicator
- Handle WebSocket disconnection gracefully
- Add fallback to polling if WebSocket fails
Code to add:
useEffect(() => {
const unsubscribe = apiClient.subscribeToStatus((data) => {
setStatus(data);
});
return () => unsubscribe();
}, []);File: atlantic-dashboard/app/dashboard/page.tsx
- Connect button →
/api/proxy/connect - Disconnect button →
/api/proxy/disconnect - Rotate IP button →
/api/rotation/session/new - Real-time status updates via WebSocket
- Error handling with user feedback
File: atlantic-dashboard/app/dashboard/locations/page.tsx
- Fetch locations →
/api/locations/available - Connect to location →
/api/rotation/geo+/api/proxy/connect - Add to favorites → Local storage or API
- Search functionality (client-side)
- Loading states
File: atlantic-dashboard/app/dashboard/protocol/page.tsx
- Fetch current protocol →
/api/protocol/current - Change protocol →
/api/protocol/set - Show credentials →
/api/protocol/credentials - Copy to clipboard functionality
- Plan-based access control (Personal+)
File: atlantic-dashboard/app/dashboard/rotation/page.tsx
- Fetch config →
/api/rotation/config - Update mode →
/api/rotation/config(POST) - Force rotation →
/api/rotation/session/new - Fetch stats →
/api/rotation/stats - Real-time rotation events
File: atlantic-dashboard/app/dashboard/security/page.tsx
- Fetch status →
/api/security/status - Toggle kill switch →
/api/killswitch - Run leak test →
/api/security/test - Real-time security updates
- Anonymity score display
File: atlantic-dashboard/app/dashboard/adblock/page.tsx
- Fetch stats →
/adblock/stats - Toggle categories →
/adblock/categories - Fetch whitelist →
/adblock/whitelist - Add to whitelist →
/adblock/whitelist(POST) - Remove from whitelist →
/adblock/whitelist(DELETE) - Refresh lists →
/adblock/refresh
File: atlantic-dashboard/app/dashboard/statistics/page.tsx
- Fetch stats →
/api/statistics - Fetch hourly data →
/api/statistics/hourly - Fetch top countries →
/api/statistics/countries - Real-time data updates
- Chart rendering
File: atlantic-dashboard/app/dashboard/servers/page.tsx
- Fetch server list →
/api/servers/list - Fetch server status →
/api/servers/status - Connect to server →
/api/servers/connect - Real-time latency updates
- Server health indicators
File: atlantic-dashboard/app/dashboard/settings/page.tsx
- Fetch user settings →
/api/settings - Update settings →
/api/settings(POST) - Change password →
/api/auth/password - Update preferences →
/api/settings/preferences - Form validation
File: atlantic-dashboard/app/dashboard/billing/page.tsx
- Fetch subscription →
/api/billing/subscription - Fetch usage →
/api/billing/usage - Cancel subscription →
/api/billing/cancel - Update payment method →
/api/billing/payment-method - View invoices →
/api/billing/invoices
File: atlantic-dashboard/app/dashboard/usage/page.tsx
- Fetch usage data →
/api/billing/usage - Fetch protocol breakdown →
/api/statistics/protocols - Fetch daily usage →
/api/statistics/daily - Chart rendering
- Export data functionality
File: atlantic-dashboard/app/dashboard/activity/page.tsx
- Fetch activity log →
/api/activity/log - Filter by type → Query params
- Filter by date → Query params
- Pagination
- Real-time activity updates
File: scripts/proxy-client/internal/api/server.go
-
GET /api/protocol/current- Get current protocol -
POST /api/protocol/set- Change protocol -
GET /api/servers/list- List available servers -
GET /api/servers/status- Server health status -
POST /api/servers/connect- Connect to specific server -
GET /api/statistics/hourly- Hourly statistics -
GET /api/statistics/countries- Top countries -
GET /api/statistics/protocols- Protocol breakdown -
GET /api/statistics/daily- Daily usage -
GET /api/activity/log- Activity log -
GET /api/settings- User settings -
POST /api/settings- Update settings -
POST /api/settings/preferences- Update preferences
- Add toast notifications for errors
- Add loading states to all buttons
- Add retry logic for failed requests
- Add offline detection
- Add connection status indicator
- Skeleton loaders for data fetching
- Button loading spinners
- Page-level loading indicators
- Optimistic UI updates
- Connect to WebSocket on dashboard load
- Receive status updates in real-time
- Reconnect after connection loss
- Handle multiple tabs (multiple connections)
- Graceful degradation to polling
- Test all 13 tabs load without errors
- Test all buttons trigger correct API calls
- Test all forms submit successfully
- Test error messages display correctly
- Test loading states work properly
- Connect → See status update via WebSocket
- Rotate IP → See new IP via WebSocket
- Toggle kill switch → See status change
- Change location → See location update
- All tabs show consistent data
- Fix WebSocket backend broadcasting
- Fix WebSocket frontend connection
- Re-enable WebSocket in dashboard
- Test real-time updates
- Fix Locations tab connectivity
- Fix Protocol tab connectivity
- Fix IP Rotation tab connectivity
- Fix Security tab connectivity
- Fix remaining tabs (Ad-blocking, Statistics, Servers)
- Add missing API endpoints
- Add error handling
- Full integration testing
cd scripts/proxy-client
# Edit internal/api/server.go
# Verify /ws endpoint and broadcasting
go run ./cmd/servicecd atlantic-dashboard
# Edit lib/api.ts
# Update WebSocket URL and reconnection logic
npm run dev# Open browser console
# Navigate to http://localhost:3456/dashboard
# Check for WebSocket connection in Network tab
# Trigger connect/disconnect and verify real-time updates- WebSocket connects automatically on dashboard load
- Status updates appear in real-time (no manual refresh)
- All 13 dashboard tabs load without errors
- All buttons trigger correct API calls
- All forms submit successfully
- Error messages display clearly
- Loading states work properly
- App works offline (graceful degradation)
- WebSocket URL hardcoded - Should use env variable
- No reconnection logic - Fails permanently on disconnect
- Dashboard polling removed - Breaks when WebSocket fails
- Missing API endpoints - Some tabs have no backend
- No error boundaries - Crashes propagate to entire app
- No loading states - Users don't know when data is loading
scripts/proxy-client/internal/api/server.goscripts/proxy-client/internal/api/websocket.go(create if needed)scripts/proxy-client/internal/api/handlers.go
atlantic-dashboard/lib/api.tsatlantic-dashboard/app/dashboard/page.tsxatlantic-dashboard/app/dashboard/locations/page.tsxatlantic-dashboard/app/dashboard/protocol/page.tsxatlantic-dashboard/app/dashboard/rotation/page.tsxatlantic-dashboard/app/dashboard/security/page.tsxatlantic-dashboard/app/dashboard/adblock/page.tsxatlantic-dashboard/app/dashboard/statistics/page.tsxatlantic-dashboard/app/dashboard/servers/page.tsxatlantic-dashboard/app/dashboard/settings/page.tsxatlantic-dashboard/app/dashboard/billing/page.tsxatlantic-dashboard/app/dashboard/usage/page.tsxatlantic-dashboard/app/dashboard/activity/page.tsxatlantic-dashboard/components/ui/toast.tsx(create)atlantic-dashboard/lib/websocket.ts(create)
- Start with WebSocket - Get real-time updates working first
- Test incrementally - Fix one tab at a time
- Use browser DevTools - Monitor Network tab for API calls
- Add console.logs - Debug WebSocket messages
- Test error cases - Disconnect backend, test offline mode
Status: Ready to implement
Next Step: Start with Phase 1 (WebSocket Backend)