jsdelivr / globalping-cli

A simple CLI tool to run networking commands remotely from hundreds of globally distributed servers
Mozilla Public License 2.0
144 stars 13 forks source link

Implement guidelines #46

Closed didil closed 1 year ago

didil commented 1 year ago

Based on https://github.com/jsdelivr/globalping/blob/master/docs/CLIENT_GUIDELINES.md Fixes #33

Set the inProgressUpdates option to true if the application is running in interactive mode so that the user sees the results right away. If the application is interactive by default but also implements a "CI" mode to be used in scripts, do not set the flag in the CI mode

  • done in previous PR

Use the following algorithm for measurement result pooling: Request the measurement status. If the status is in-progress, wait 1 second and repeat from step 1. Note that it is important to wait 1 second after receiving the response, instead of simply using an "every second interval". For large measurements, the request itself may take a few hundred milliseconds to complete. If the status is anything else, stop. The measurement is no longer running.

  • Implemented with 500 ms interval as it gives more real-time looking results

Set a User-Agent header. The recommended format and approach is as here.

  • Done (Format globalping-cli/{Version} (https://github.com/jsdelivr/globalping-cli))

Set an Accept-Encoding header with a value of either br (preferred) or gzip, depending on what your client can support. The compression has a significant impact on the response size.

  • Implemented with br

When requesting the measurement status, implement ETag-based client-side caching using the ETag/If-None-Match headers.

  • Implemented