# Code , complete app.py with full code for /stream, /dashboard, CSV download, and WebSocket handling.
from fastapi import FastAPI, WebSocket
from fastapi.responses import HTMLResponse, StreamingResponse
import uvicorn
import json
import csv
from io import StringIO
app = FastAPI()
telemetry_data = [] # list to hold telemetry data
dashboard_connections = [] # active dashboard WebSocket connections
@app.get("/stream")
async def stream():
html = """