feat(ws): opt-in includeRepeats streams later hearings over new paths - #178
Merged
Merged
Conversation
Duplicate observations are dropped before the hub today, so a live map only sees each packet's first hearing per observer. Clients that configure includeRepeats also get later hearings whose path is new; nothing is stored, repeats skip the count query, and they are dropped first when the broadcast channel is half full.
This was referenced Sep 29, 2026
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.
A flood packet reaches an observer more than once: first from the nearest repeater, then again whenever a repeater further out rebroadcasts it, each time over a different path. We only store and stream the first hearing per (packet, observer), because the observation insert is
ON CONFLICT DO NOTHINGand the event is only built when the row went in. That's the right behaviour for storage, but a live map that animates a packet spreading through the mesh never sees most of the spread.This adds a connection-wide opt-in,
configure { includeRepeats: true }. Clients that send it also get those later hearings as ordinarypacketObservationevents withpacket.isRepeat: true. Clients that don't opt in see byte-identical events.How it works:
handlePacketalready has in hand for duplicates, and it skipsGetPacketObservationCount, soobservationCountis 0 on repeats.BroadcastRepeat, which drops the repeat once the broadcast channel is half full. Those drops are counted and logged at most once a minute.The protocol change is backwards compatible. An older server ignores the unknown
includeRepeatsfield, and the new field isomitempty.Tests cover hub routing and the opt-in counter, the drop-first path, the sent-path store (window, new path, size bound),
handlePacketend to end (first hearing, broker copy, new path, same path again, opt-in off, no count query on repeats), and a realconfigureround trip through the handler. No API or swagger changes.