Overview
Themeasurements config option accepts an ordered array of MeasurementConfig objects. The engine executes each entry in sequence. Every object must include a type field; the remaining fields depend on the type.
TypeScript union type
Default measurement sequence
When nomeasurements option is provided, the engine runs the following sequence. File sizes grow progressively so the engine can characterize bandwidth across a wide range of connection speeds — a strategy called ramp-up:
The ramp-up strategy means slower connections naturally stop at smaller file sizes: once a request in a given direction takes at least
bandwidthFinishRequestDuration milliseconds (default: 1000 ms), all remaining measurement sets for that direction are skipped. Set bandwidthFinishRequestDuration to 0 to disable early stopping and always run every configured step.Measurement variants
latency
Measures unloaded (idle) round-trip latency. Each packet is a GET request to the download API endpoint with bytes=0. The round-trip time is extracted from the requestStart → responseStart timing interval provided by the PerformanceResourceTiming API.
Must be
"latency".Number of GET requests to perform. More packets yield a more stable latency estimate. The default sequence uses
1 for a quick initial estimate and 20 for the main measurement.download
Performs a set of download GET requests against downloadApiUrl. Each request fetches a response body of exactly bytes bytes. Bandwidth per request is calculated as transferSize (bits) / duration (seconds), where duration excludes server processing time.
Must be
"download".Number of bytes to request. Passed to the download API as a query parameter. Use scientific notation for readability (for example,
1e6 for 1 MB, 1e8 for 100 MB).Number of sequential requests to perform at this file size. Multiple requests improve statistical stability at each size tier.
When
true, the bandwidthFinishRequestDuration threshold check is skipped for this entry and the engine always proceeds to the next measurement set regardless of request duration. Used in the default sequence for the very first download entry to ensure an initial estimate is always obtained, even on very slow connections.upload
Performs a set of upload POST requests against uploadApiUrl. Each request posts a body of exactly bytes bytes. Bandwidth calculation is identical to the download type.
Must be
"upload".Number of bytes to include in each POST request body.
Number of sequential requests to perform at this payload size.
When
true, ignores the bandwidthFinishRequestDuration check and always proceeds to the next measurement set.packetLoss
Measures packet loss by sending UDP packets to a WebRTC TURN server in a round-trip fashion, then counting how many packets were not returned. Packets are sent in configurable batches to avoid flooding the connection.
All fields are optional — omitting { type: 'packetLoss' } entirely uses the defaults shown below.
Must be
"packetLoss".Total number of UDP packets to send. The default sequence overrides this to
1000 for higher accuracy.Number of packets per batch. If
batchSize is greater than numPackets, all packets are sent in a single batch.Time in milliseconds to wait between consecutive batches.
Time in milliseconds to wait after the last received packet before declaring the measurement complete. Any packets not returned within this window are counted as lost. The default sequence uses
3000 ms.Time in milliseconds to wait when establishing the connection to the TURN server before giving up.
