v157 · web bluetooth
Firmware transfer simulator
Packet counts are abstract; minutes are not. Push the same firmware image down two simulated links — one at the 20-byte assumption, one at the negotiated size — and watch them separate in real time. The model is the one that governs BLE throughput: writes are paced by the connection interval, several per event.
Run the transfer
A BLE central sends a handful of packets per connection event, and events happen once per connection interval. Throughput is therefore packets per event x write size / interval — which is why a bigger write size, not a faster radio, is what makes a firmware update finish.
Assuming 20 bytes
idle
- Packets
- 0
- Sent
- 0 B
- Elapsed (simulated)
- 0.0 s
Reading maxWriteWithoutResponseSize
idle
- Packets
- 0
- Sent
- 0 B
- Elapsed (simulated)
- 0.0 s
code path
// Throughput is set by how much fits in each connection event.
const perSecond = (packetsPerEvent * writeSize) / (intervalMs / 1000);
const seconds = imageBytes / perSecond;
// Which is why this one line is the whole optimisation:
const writeSize = server.maxWriteWithoutResponseSize ?? 20;