One structure, three responsibilities
The registry is the heart of the gateway. It tracks every known node and does three jobs at once:
- Discovery — a broadcast beacon lets new nodes announce themselves; the registry records them as pending.
- De-duplication & replay defense — each node's last-seen counter gates every incoming frame.
- Liveness — a last-seen timestamp drives the "online / offline" state you see in the app and on the display.
Keeping it bounded
Embedded memory is finite and predictable behavior matters more than capacity. The registry is a fixed-size table sized for a real home or small industrial deployment. When it's full, admission is refused loudly rather than silently overwriting a node.
Bounded, inspectable, and easy to reason about beats clever and unbounded every time on a device that has to run for years without a reboot.