Events

Socket.IO event types and payloads.

Aircraft Events

Subscribe to aircraft topic.

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#3b82f6', 'primaryTextColor': '#fff', 'primaryBorderColor': '#60a5fa', 'lineColor': '#60a5fa', 'actorTextColor': '#fff', 'actorBkg': '#1e3a5f', 'actorBorder': '#3b82f6'}}}%%
sequenceDiagram
    participant C as 📱 Client
    participant S as 🖥️ Server

    C->>S: 🔗 Connect with topics=aircraft
    S->>C: ✈️ aircraft:snapshot (all current)

    loop ⏱️ Every update
        S->>C: 🔄 aircraft:update (changes only)
    end

    S->>C: 👋 aircraft:remove (left coverage)

Sent immediately on connection. Contains all currently tracked aircraft.

{
  "aircraft": [
    {
      "hex": "A12345",
      "flight": "UAL123",
      "lat": 47.6062,
      "lon": -122.3321,
      "alt": 35000,
      "gs": 450,
      "track": 270,
      "vr": -500,
      "squawk": "1200",
      "category": "A3",
      "type": "B738",
      "military": false,
      "emergency": false
    }
  ],
  "count": 1,
  "timestamp": "2024-01-15T12:00:00Z"
}

Aircraft Object Fields

FieldTypeDescription
hexstring🔢 ICAO 24-bit address
flightstring🏷️ Callsign (if available)
lat, lonnumber📍 Position coordinates
altnumber📏 Altitude in feet
gsnumber💨 Ground speed in knots
tracknumber🧭 Track heading in degrees
vrnumber↕️ Vertical rate in ft/min
squawkstring📻 Transponder code
categorystring📦 Aircraft size category
typestring✈️ ICAO aircraft type code
militaryboolean🎖️ Military aircraft flag
emergencyboolean🚨 Emergency squawk detected

Safety Events

Subscribe to safety topic.

safety:event

FieldTypeValues
event_typestringproximity_conflict, tcas_ra_detected, extreme_vertical_rate, emergency_squawk
severitystringwarning, critical
icaostringPrimary aircraft ICAO
icao_2stringSecondary aircraft (for conflicts)
messagestringHuman-readable description
{
  "event_type": "proximity_conflict",
  "severity": "critical",
  "icao": "A12345",
  "icao_2": "B67890",
  "callsign": "UAL123",
  "message": "Proximity conflict: 0.5nm lateral, 500ft vertical separation",
  "details": {
    "distance_nm": 0.5,
    "altitude_diff_ft": 500
  },
  "timestamp": "2024-01-15T12:00:00Z"
}

Alert Events

Subscribe to alerts topic. Fired when custom alert rules match.

alert:triggered

{
  "rule_id": 1,
  "rule_name": "Low Altitude Alert",
  "icao": "A12345",
  "callsign": "UAL123",
  "message": "Aircraft below 3000ft within 10nm",
  "priority": "warning",
  "aircraft_data": {
    "hex": "A12345",
    "alt": 2500,
    "lat": 47.6,
    "lon": -122.3
  }
}

ACARS Events

Subscribe to acars topic. Requires ACARS receiver configured.

acars:message

{
  "source": "acars",
  "icao_hex": "A12345",
  "registration": "N12345",
  "label": "H1",
  "text": "DEPARTURE CLEARANCE CONFIRMED SEA",
  "frequency": 130.025,
  "signal_level": -42.5
}

Dynamic Subscriptions

🔄 Change subscriptions at runtime
// Add a subscription
socket.emit('subscribe', { topics: ['acars'] });

// Remove a subscription
socket.emit('unsubscribe', { topics: ['safety'] });