Fix aircraft track propagation issues in web frontend
This commit addresses issue #23 where aircraft track changes were not propagating properly to the web frontend. The fixes include: **Server-side improvements:** - Enhanced WebSocket broadcast reliability with timeout-based queueing - Increased broadcast channel buffer size (1000 -> 2000) - Improved error handling and connection management - Added write timeouts to prevent slow clients from blocking updates - Enhanced connection cleanup and ping/pong handling - Added debug endpoint /api/debug/websocket for troubleshooting - Relaxed position validation thresholds for better track acceptance **Frontend improvements:** - Enhanced WebSocket manager with exponential backoff reconnection - Improved aircraft position update detection and logging - Fixed position update logic to always propagate changes to map - Better coordinate validation and error reporting - Enhanced debugging with detailed console logging - Fixed track rotation update thresholds and logic - Improved marker lifecycle management and cleanup - Better handling of edge cases in aircraft state transitions **Key bug fixes:** - Removed overly aggressive position change detection that blocked updates - Fixed track rotation sensitivity (5° -> 10° threshold) - Enhanced coordinate validation to handle null/undefined values - Improved WebSocket message ordering and processing - Fixed marker position updates to always propagate to Leaflet These changes ensure reliable real-time aircraft tracking with proper position, heading, and altitude updates across multiple data sources. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
8ffb657711
commit
1fe15c06a3
6 changed files with 216 additions and 49 deletions
|
|
@ -217,8 +217,12 @@ class SkyView {
|
|||
}
|
||||
|
||||
handleWebSocketMessage(message) {
|
||||
const aircraftCount = Object.keys(message.data.aircraft || {}).length;
|
||||
console.debug(`WebSocket message: ${message.type}, ${aircraftCount} aircraft, timestamp: ${message.timestamp}`);
|
||||
|
||||
switch (message.type) {
|
||||
case 'initial_data':
|
||||
console.log(`Received initial data with ${aircraftCount} aircraft`);
|
||||
this.updateData(message.data);
|
||||
// Setup source markers only on initial data load
|
||||
this.mapManager.updateSourceMarkers();
|
||||
|
|
@ -227,23 +231,32 @@ class SkyView {
|
|||
this.updateData(message.data);
|
||||
break;
|
||||
default:
|
||||
console.warn(`Unknown WebSocket message type: ${message.type}`);
|
||||
}
|
||||
}
|
||||
|
||||
updateData(data) {
|
||||
// Update all managers with new data
|
||||
// Update all managers with new data - ORDER MATTERS
|
||||
console.debug(`Updating data: ${Object.keys(data.aircraft || {}).length} aircraft`);
|
||||
|
||||
this.uiManager.updateData(data);
|
||||
this.aircraftManager.updateAircraftData(data);
|
||||
this.mapManager.updateSourcesData(data);
|
||||
|
||||
// Update UI components
|
||||
// Update UI components - CRITICAL: updateMarkers must be called for track propagation
|
||||
this.aircraftManager.updateMarkers();
|
||||
|
||||
// Update map components that depend on aircraft data
|
||||
this.mapManager.updateSourceMarkers();
|
||||
|
||||
// Update UI tables and statistics
|
||||
this.uiManager.updateAircraftTable();
|
||||
this.uiManager.updateStatistics();
|
||||
this.uiManager.updateHeaderInfo();
|
||||
|
||||
// Clear selected aircraft if it no longer exists
|
||||
if (this.selectedAircraft && !this.aircraftManager.aircraftData.has(this.selectedAircraft)) {
|
||||
console.debug(`Selected aircraft ${this.selectedAircraft} no longer exists, clearing selection`);
|
||||
this.selectedAircraft = null;
|
||||
}
|
||||
|
||||
|
|
@ -253,6 +266,8 @@ class SkyView {
|
|||
if (this.uiManager.currentView === 'radar3d-view') {
|
||||
this.update3DRadar();
|
||||
}
|
||||
|
||||
console.debug(`Data update complete: ${this.aircraftManager.aircraftMarkers.size} markers displayed`);
|
||||
}
|
||||
|
||||
// View switching
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue