package api import ( "encoding/json" "net/http" ) // POST /api/telemetry?id= — HTTP alternative to the websocket for // pushing a single event (handy for testing with curl). func (s *Server) handleTelemetryPost(w http.ResponseWriter, r *http.Request) { id := r.URL.Query().Get("id") if id == "" { id = "default" } var raw map[string]any if err := json.NewDecoder(r.Body).Decode(&raw); err != nil { writeError(w, http.StatusBadRequest, "invalid json") return } s.hub.Ingest(id, raw) writeJSON(w, http.StatusOK, map[string]any{"ok": true}) }