BREAKING CHANGE(serviceworker): Move serviceworker speedtest to time-based chunked transfers and update dashboard/server contract

This commit is contained in:
2025-12-04 13:42:19 +00:00
parent 5f015380be
commit 43a335ab3a
6 changed files with 83 additions and 53 deletions

View File

@@ -215,6 +215,14 @@ export interface IRequest_Serviceworker_CacheInvalidate
/**
* Speedtest request between service worker and backend
*
* Types:
* - 'latency': Simple ping to measure round-trip time
* - 'download_chunk': Request a chunk of data (64KB default)
* - 'upload_chunk': Send a chunk of data to server
*
* The client runs a loop calling download_chunk or upload_chunk
* until the desired test duration (e.g., 5 seconds) elapses.
*/
export interface IRequest_Serviceworker_Speedtest
extends plugins.typedrequestInterfaces.implementsTR<
@@ -223,15 +231,13 @@ export interface IRequest_Serviceworker_Speedtest
> {
method: 'serviceworker_speedtest';
request: {
type: 'download' | 'upload' | 'latency';
payloadSizeKB?: number; // Size of test payload in KB (default: 100)
payload?: string; // For upload tests, the payload to send
type: 'latency' | 'download_chunk' | 'upload_chunk';
chunkSizeKB?: number; // Size of chunk in KB (default: 64)
payload?: string; // For upload_chunk, the data to send
};
response: {
durationMs: number;
bytesTransferred: number;
speedMbps: number;
timestamp: number;
payload?: string; // For download tests, the payload received
payload?: string; // For download_chunk, the data received
};
}