1. Problem & Architecture Goals
When monitoring long-running enterprise backup routines, polling an HTTP API every second generates wasteful TCP handshakes, server CPU spikes, and sluggish latency. The goal was to build a zero-overhead Python daemon that could monitor backup progress in real time and broadcast updates to mobile client subscribers instantly.
2. Asynchronous Event-Driven Design
- AsyncIO Concurrency: Non-blocking coroutine loop that handles dozens of simultaneous client WebSocket subscriptions while polling filesystem sockets.
- Differential JSON Payloads: Only sending delta changes (e.g. transfer percent, speed delta, new log lines) rather than full state dumps to conserve mobile cellular bandwidth.
- Heartbeat Pings: Dynamic ping/pong keepalive messages that detect severed client connections within 5 seconds and gracefully reclaim server socket resources.