Skip to content

feat: real-time updates over SSE across the app + live map (brightness, animated cluster ratio, hover card)#490

Merged
SimmerV merged 10 commits into
MeshAddicts:developfrom
SimmerV:feature-addition
Jun 8, 2026
Merged

feat: real-time updates over SSE across the app + live map (brightness, animated cluster ratio, hover card)#490
SimmerV merged 10 commits into
MeshAddicts:developfrom
SimmerV:feature-addition

Conversation

@SimmerV

@SimmerV SimmerV commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

Real-time SSE platform + live map

Replaces poll-driven refreshes with a push model: one server-sent-events stream
feeds live node, chat, packet, and telemetry updates to every page, and the map
now reacts to that stream instead of being a static load-time snapshot.

Backend — SSE fan-out

  • broadcaster.py (new): in-process pub/sub hub. One bounded asyncio.Queue
    per subscriber; publish() is synchronous and never awaits, so the MQTT ingest
    path can emit without ever blocking on a slow client. Backpressure drops the
    oldest item per slow subscriber.
  • GET /v1/events (api/api.py): text/event-stream route, one queue per
    client, typed events (node | chat | packet | telemetry).
  • Producers: data_store.update_node publishes node; mqtt.handle_log
    publishes packet (raw msg + mqtt_row_id), handle_telemetry publishes
    telemetry, handle_text publishes chat. Payloads are isolated snapshots.
  • Caddy (Caddyfile.dev/.sample): proxy tuned for SSE (no buffering, long
    timeouts) on the /v1/events route.
  • Tests: tests/test_broadcaster.py (fan-out, drop-oldest, snapshot
    isolation) and tests/test_mqtt_handlers.py (packet/telemetry/chat publish).

Frontend — shared live infrastructure

  • LiveEventsProvider (components/LiveEvents.tsx): owns the single
    EventSource, coalesces node bursts into the RTK Query getNodes cache
    (~400 ms), pings chat, and resyncs on (re)connect. Exposed via context.
  • useLiveEvent(type, handler) (hooks/useLiveEvent.ts): subscribe any
    component to an extra event type on the one shared connection.
  • LivePill (components/LivePill.tsx): shared 3-state (live / paused / off)
    indicator; top bars unified across Logs, Chat, Nodes, Stats, Neighbors,
    Telemetry, and Traceroutes.

Bug Fix

Per-page live features

  • Logs: live packet feed over SSE, anchored to the top, pauses on scroll-away
    or packet selection, de-duped against the fetched archive.
  • Telemetry: live telemetry stream with the same scroll/select freeze.
  • Chat / Nodes / Stats / Neighbors / Traceroutes: live node + chat updates
    push straight into the cache; no manual refresh.

Live map

  • New nodes appear live and node brightness encodes recency: a quantized
    dim (by last_seen age) drives circle opacity, so nodes brighten when
    re-heard and fade as they go quiet. Quantized into buckets so re-hears don't
    churn the source; a nodesDataSignature skip-guard avoids redundant setData
    (and the cluster-donut rebuild each one triggers) on no-op flushes.
  • Animated cluster ratio ring (clusterDonutLayer.ts): donuts ease between
    real online/total ratios instead of snapping, keyed by position so tweens
    survive cluster-id churn, with a self-stopping repaint clock and
    prefers-reduced-motion support.
  • Live cluster hover card (ClusterHoverCard.tsx): hovering a cluster shows
    node count, online ratio, role breakdown, and a last-heard leaderboard, all
    hydrated from the live node cache so it stays current while open.
  • Groundwork: normalizeNodeId8 (+tests) and a reducedMotion helper.

@SimmerV SimmerV self-assigned this Jun 7, 2026
@SimmerV SimmerV added the enhancement New feature or request label Jun 7, 2026
@SimmerV SimmerV added this to meshinfo Jun 7, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in meshinfo Jun 7, 2026
@SimmerV SimmerV added the bug Something isn't working label Jun 7, 2026
@SimmerV SimmerV merged commit 55025ad into MeshAddicts:develop Jun 8, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in meshinfo Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Bug(map): selecting node on nodes page renders map preview incorrectly

1 participant