Before shipping it, separate protocol facts, product promises, and operating cost. Mixing those layers produces confident but incorrect decisions. One in-flight chunk wastes a high-RTT path; hundreds of megabytes exhaust memory and delay control. The window is unacknowledged bytes and should respond to path feedback, not chunk size alone.
File transfer must reconcile sender offsets, durable receiver writes, chunk integrity, and terminal state on both peers. A full progress bar may show queued bytes, not a complete usable file.
The parts that make the design practical
Start from facts the data and protocol can guarantee, then decide what the interface may promise. Each rule below needs an owner, a bound, and a compatibility policy rather than an oral convention from one review.
- Start conservatively and grow gradually per RTT after stable acknowledgements rather than indefinitely exponential growth.
- Reduce the window quickly after timeout, repeated gaps, or sustained high bufferedAmount.
- Set a device memory cap and reserve control capacity, with separate mobile and desktop profiles.
The goal is not a momentary speed peak. It is stable throughput, bounded memory, and responsive control across RTTs and device classes.
Keep false assumptions out of production
Prioritize faults that silently preserve false facts: the interface looks recovered while a queue, permission, or counter has diverged. The defect often appears only on the next action.
- Receiver storage delay is mistaken for congestion, collapsing the window repeatedly.
- The window counts chunks rather than bytes, so a chunk-size change doubles memory unexpectedly.
- A large old-path window survives a network change and bursts onto the new route.
What the release gate should inspect
Observe both endpoints, persisted records, and operational signals during verification. One button state or one successful response cannot prove the complete loop.
- Change RTT at fixed bandwidth and verify the window fills the bandwidth-delay product while control latency remains bounded.
- Throttle receiver CPU, storage, and network separately to verify stable, distinguishable convergence.
- Switch between direct and TURN mid-transfer and record reset, recovery time, and peak memory.
The result must be correct, recoverable, and explainable. If any part depends on refreshing the page or an engineer guessing, the protocol loop remains incomplete.