feat: real-time updates over SSE across the app + live map (brightness, animated cluster ratio, hover card)#490
Merged
Conversation
…he shared LivePill
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 boundedasyncio.Queueper subscriber;
publish()is synchronous and never awaits, so the MQTT ingestpath 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-streamroute, one queue perclient, typed events (
node|chat|packet|telemetry).data_store.update_nodepublishesnode;mqtt.handle_logpublishes
packet(raw msg +mqtt_row_id),handle_telemetrypublishestelemetry,handle_textpublisheschat. Payloads are isolated snapshots.Caddyfile.dev/.sample): proxy tuned for SSE (no buffering, longtimeouts) on the
/v1/eventsroute.tests/test_broadcaster.py(fan-out, drop-oldest, snapshotisolation) and
tests/test_mqtt_handlers.py(packet/telemetry/chat publish).Frontend — shared live infrastructure
LiveEventsProvider(components/LiveEvents.tsx): owns the singleEventSource, coalescesnodebursts into the RTK QuerygetNodescache(~400 ms), pings chat, and resyncs on (re)connect. Exposed via context.
useLiveEvent(type, handler)(hooks/useLiveEvent.ts): subscribe anycomponent 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
or packet selection, de-duped against the fetched archive.
push straight into the cache; no manual refresh.
Live map
dim(bylast_seenage) drives circle opacity, so nodes brighten whenre-heard and fade as they go quiet. Quantized into buckets so re-hears don't
churn the source; a
nodesDataSignatureskip-guard avoids redundantsetData(and the cluster-donut rebuild each one triggers) on no-op flushes.
clusterDonutLayer.ts): donuts ease betweenreal online/total ratios instead of snapping, keyed by position so tweens
survive cluster-id churn, with a self-stopping repaint clock and
prefers-reduced-motionsupport.ClusterHoverCard.tsx): hovering a cluster showsnode count, online ratio, role breakdown, and a last-heard leaderboard, all
hydrated from the live node cache so it stays current while open.
normalizeNodeId8(+tests) and areducedMotionhelper.