[webkit-dev] Network Information API reboot: request for early feedback
Thomas Steiner
tomac at google.com
Fri Aug 20 07:50:19 PDT 2021
Hey WebKit folks,
I have rebooted the Network Information API recently. This is all in a
relatively early stage, but I thought now would be a good time to get your
feedback on the proposal:
- Motivational doc:
https://docs.google.com/document/d/1RDA23zSNdDuIcxZTX9Xo3zlD2fxf8dZg9-e0YaJQv0g/edit?usp=sharing
- Explainer: https://github.com/tomayac/netinfo/blob/relaunch/README.md
- Spec draft: https://ghcdn.rawgit.org/tomayac/netinfo/relaunch/index.html
Here is the short version:
```js
// Is the current network a metered network according to the OS-level
setting
// in, e.g., Android or Windows, i.e., _without_ the UA guesstimating it.
The UA
// may provide its own (override) setting, though:
navigator.connection.metered;
// false
// What is the sustained connection speed, as measured on the OS-level (à la
// `nettop`) for a sliding window and bucketed in buckets of exponentially
// growing size in bit per second, e.g., 25,000,000 (25 Mbit/s), 50,000,000
// (50 Mbit/s). It's fine to report `Infinity` if the user agent doesn't
want to
// reveal more, or if the sustained speed isn't known yet.
navigator.connection.metered;
// 50000000
// Changes to either of the attributes are exposed via an event:
navigator.connection.addEventListener("change", (event) => {
console.log(event);
});
```
Each of the attributes is accompanied by a client hint header that reflects
the attribute:
```bash
Sec-CH-Metered-Connection: 1
Sec-CH-Sustained-Speed: 50000000
```
Thanks in advance for your thoughts, here, or in the motivational document.
Cheers,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20210820/c0c43b71/attachment.htm>
More information about the webkit-dev
mailing list