├── .pr-preview.json ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── downlink.json ├── examples └── example1.html ├── index.html └── w3c.json /.pr-preview.json: -------------------------------------------------------------------------------- 1 | { 2 | "src_file": "index.html", 3 | "type": "respec" 4 | } 5 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Web Platform Incubator Community Group 2 | 3 | This repository is being used for work in the Web Platform Incubator Community Group, governed by the [W3C Community License 4 | Agreement (CLA)](http://www.w3.org/community/about/agreements/cla/). To contribute, you must join 5 | the CG. 6 | 7 | If you are not the sole contributor to a contribution (pull request), please identify all 8 | contributors in the pull request's body or in subsequent comments. 9 | 10 | To add a contributor (other than yourself, that's automatic), mark them one per line as follows: 11 | 12 | ``` 13 | +@github_username 14 | ``` 15 | 16 | If you added a contributor by mistake, you can remove them in a comment with: 17 | 18 | ``` 19 | -@github_username 20 | ``` 21 | 22 | If you are making a pull request on behalf of someone else but you had no part in designing the 23 | feature, you can remove yourself with the above syntax. 24 | 25 | ## Style guide 26 | The spec is written in markdown and generated with [ReSpec](http://dev.w3.org/2009/dap/ReSpec.js/documentation.html). 27 | 28 | When contributing text, just follow the conventions in the document. Please note that some GitHub flavored markdown won't work (e.g., denoting the programming language in a code block). 29 | 30 | Please check that everything is ok locally (by opening index.html in the browser) before sending a pull request. 31 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | All Reports in this Repository are licensed by Contributors under the 2 | [W3C Software and Document 3 | License](http://www.w3.org/Consortium/Legal/2015/copyright-software-and-document). Contributions to 4 | Specifications are made under the [W3C CLA](https://www.w3.org/community/about/agreements/cla/). 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Network Information API 2 | This repository is the home of the **Network Information API**, currently incubating at the [WICG](https://wicg.io). 3 | 4 | ## Contributing 5 | Everyone is welcome to contribute to this specification, but please see our [contributors guide](CONTRIBUTING.md). 6 | 7 | ## Useful links 8 | * [Network Information API specification](http://wicg.github.io/netinfo/) 9 | * [Use cases and requirements](http://w3c-webmob.github.io/netinfo-usecases/) 10 | -------------------------------------------------------------------------------- /downlink.json: -------------------------------------------------------------------------------- 1 | { 2 | "wimax":[{ 3 | "name": "WiMAX 1", 4 | "version": "rel 1", 5 | "max": { 6 | "downlink": 37.0, 7 | "uplink": 17.0 8 | }, 9 | "ref": { 10 | "url": "http://en.wikipedia.org/wiki/WiMAX#Comparison_with_other_mobile_Internet_standards" 11 | } 12 | },{ 13 | "name": "WiMAX 1.5", 14 | "version": "rel 1.5", 15 | "max": { 16 | "downlink": 141.0, 17 | "uplink": 138.0 18 | }, 19 | "ref": { 20 | "url": "http://en.wikipedia.org/wiki/WiMAX#Comparison_with_other_mobile_Internet_standards" 21 | } 22 | },{ 23 | "name": "WiMAX 2", 24 | "version": "rel 2", 25 | "max": { 26 | "downlink": 365.0, 27 | "uplink": 376.0 28 | }, 29 | "ref": { 30 | "url": "http://en.wikipedia.org/wiki/WiMAX#Comparison_with_other_mobile_Internet_standards" 31 | } 32 | }], 33 | "cellular": [{ 34 | "name": "GSM", 35 | "version": "2G", 36 | "max": { 37 | "downlink": 0.010, 38 | "uplink": 0.010 39 | }, 40 | "latencyRange": "1000+", 41 | "ref": { 42 | "url1": "http://en.wikipedia.org/wiki/High-Speed_Circuit-Switched_Data", 43 | "url2": "http://www.cni.co.th/download/cni_co_th/kb_dc_gsm%20vs.%20gprs.pdf" 44 | } 45 | }, { 46 | "name": "IDEN", 47 | "version": "2G", 48 | "max": { 49 | "downlink": 0.064, 50 | "uplink": 0.064 51 | }, 52 | "latencyRange": "500-1500", 53 | "ref": { 54 | "url": "http://www.rfcafe.com/references/electrical/wireless-comm-specs-new.htm" 55 | } 56 | }, { 57 | "name": "CDMA", 58 | "version": "2G", 59 | "max": { 60 | "downlink": 0.115, 61 | "uplink": 0.115 62 | }, 63 | "latencyRange": "500-1500", 64 | "ref": { 65 | "url": "http://www.rfcafe.com/references/electrical/wireless-comm-specs-new.htm" 66 | } 67 | }, { 68 | "name": "1xRTT", 69 | "version": "2.5G", 70 | "max": { 71 | "downlink": 0.153, 72 | "uplink": 0.153 73 | }, 74 | "latencyRange": "500-1000", 75 | "ref": { 76 | "url": "http://en.wikipedia.org/wiki/CDMA2000#1X" 77 | } 78 | }, { 79 | "name": "GPRS", 80 | "version": "2.5G", 81 | "max": { 82 | "downlink": 0.237, 83 | "uplink": 0.237 84 | }, 85 | "latencyRange": "500-1000", 86 | "ref": { 87 | "url": "http://en.wikipedia.org/wiki/General_Packet_Radio_Service" 88 | } 89 | }, { 90 | "name": "EDGE", 91 | "version": "2.75G", 92 | "max": { 93 | "downlink": 0.384, 94 | "uplink": 0.384 95 | }, 96 | "latencyRange": "500-600", 97 | "ref": { 98 | "url": "http://www.umtsworld.com/technology/edge.htm" 99 | } 100 | }, { 101 | "name": "UMTS", 102 | "version": "3G", 103 | "max": { 104 | "downlink": 2.0, 105 | "uplink": 2.0 106 | }, 107 | "latencyRange": "150-450", 108 | "ref": { 109 | "url": "http://www.radio-electronics.com/info/cellulartelecomms/3g-hspa/umts-high-speed-packet-access-tutorial.php" 110 | } 111 | }, { 112 | "name": "EVDO Rev 0", 113 | "version": "3.5G", 114 | "max": { 115 | "downlink": 2.46, 116 | "uplink": 2.46 117 | }, 118 | "latencyRange": "150-350", 119 | "ref": { 120 | "url": "http://en.wikipedia.org/wiki/Comparison_of_wireless_data_standards#Peak_bit_rate_and_throughput" 121 | } 122 | }, { 123 | "name": "EVDO Rev A", 124 | "version": "3.5G", 125 | "max": { 126 | "downlink": 3.1, 127 | "uplink": 3.1 128 | }, 129 | "latencyRange": "100-250", 130 | "ref": { 131 | "url": "http://en.wikipedia.org/wiki/Evolution-Data_Optimized#TIA-856_Rev._A" 132 | } 133 | }, { 134 | "name": "HSPA", 135 | "version": "3.5G", 136 | "max": { 137 | "downlink": 3.6, 138 | "uplink": 3.6 139 | }, 140 | "latencyRange": "100-250", 141 | "ref": { 142 | "url": "http://www.4gamericas.org/index.cfm?fuseaction=page§ionid=247" 143 | } 144 | }, { 145 | "name": "EVDO Rev B", 146 | "version": "3.75G", 147 | "max": { 148 | "downlink": 14.7, 149 | "uplink": 14.7 150 | }, 151 | "latencyRange": "70-150", 152 | "ref": { 153 | "url": "http://en.wikipedia.org/wiki/Evolution-Data_Optimized#TIA-856_Rev._B" 154 | } 155 | }, { 156 | "name": "HSDPA", 157 | "version": "3.75G", 158 | "max": { 159 | "downlink": 14.3, 160 | "uplink": 0.384 161 | }, 162 | "latencyRange": "70-150", 163 | "ref": { 164 | "url1": "http://www.4gamericas.org/index.cfm?fuseaction=page§ionid=247", 165 | "url2": "http://en.wikipedia.org/wiki/High-Speed_Downlink_Packet_Access#Other_improvements", 166 | "note": "HSDPA/HSUPA max downlink speeds are 14.4Mbps. However, reporting the same value via maxDownlink does not allow us to differentiate between these versions, and given the uplink performance difference (0.384Mbps vs 5.76Mbps), this is an important distinction. As a result, we're intentionally setting the downlink value for HSDPA to 14.3." 167 | } 168 | }, { 169 | "name": "HSUPA", 170 | "version": "3.75G", 171 | "max": { 172 | "downlink": 14.4, 173 | "uplink": 5.76 174 | }, 175 | "latencyRange": "70-150", 176 | "ref": { 177 | "url1": "http://www.4gamericas.org/index.cfm?fuseaction=page§ionid=247", 178 | "url2": "http://en.wikipedia.org/wiki/High-Speed_Uplink_Packet_Access" 179 | } 180 | }, { 181 | "name": "EHRPD", 182 | "version": "3.9G", 183 | "max": { 184 | "downlink": 21.0, 185 | "uplink": 21.0 186 | }, 187 | "latencyRange": "50-150", 188 | "ref": { 189 | "url": "http://www.cdg.org/news/events/cdmaseminar/09_TechForum_Sept/presentations/5-Spirent-ehrpd_9_handouts.pdf", 190 | "note": "eHRPD is a method of interworking multiple access networks (eHRPD, E-UTRAN), as such it's a mix of 3.75G-4G technologies, and there isn't a single max value. As a result, 21.0 Mbps is an in-between value." 191 | } 192 | }, { 193 | "name": "HSPAP", 194 | "version": "3.9G", 195 | "max": { 196 | "downlink": 42.0, 197 | "uplink": 42.0 198 | }, 199 | "latencyRange": "50-100", 200 | "ref": { 201 | "url": "http://www.4gamericas.org/index.cfm?fuseaction=page§ionid=248" 202 | } 203 | }, { 204 | "name": "LTE", 205 | "version": "4G", 206 | "max": { 207 | "downlink": 100.0, 208 | "uplink": 100.0 209 | }, 210 | "latencyRange": "20-70", 211 | "ref": { 212 | "url": "http://www.4gamericas.org/index.cfm?fuseaction=page§ionid=249" 213 | } 214 | }, { 215 | "name": "LTE Advanced", 216 | "version": "4G", 217 | "max": { 218 | "downlink": 100.0, 219 | "uplink": 100.0 220 | }, 221 | "latencyRange": "20-50", 222 | "ref": { 223 | "url": "http://www.4gamericas.org/index.cfm?fuseaction=page§ionid=249" 224 | } 225 | }], 226 | 227 | "bluetooth": [{ 228 | "name": "1.2", 229 | "version": "1.2", 230 | "max": { 231 | "downlink": 1.0, 232 | "uplink": 1.0 233 | }, 234 | "latencyRange": "75-125", 235 | "ref": { 236 | "url": "http://en.wikipedia.org/wiki/Bluetooth#Uses" 237 | } 238 | }, { 239 | "name": "2.1 + Enhanced Data Rate (EDR)", 240 | "version": "2.1+EDR", 241 | "max": { 242 | "downlink": 3.0, 243 | "uplink": 3.0 244 | }, 245 | "latencyRange": "75-125", 246 | "ref": { 247 | "url": "http://en.wikipedia.org/wiki/Bluetooth#Uses" 248 | } 249 | }, { 250 | "name": "3.0 + High Speed (HS)", 251 | "version": "3.0+HS", 252 | "max": { 253 | "downlink": 24.0, 254 | "uplink": 24.0 255 | }, 256 | "latencyRange": "75-125", 257 | "ref": { 258 | "url1": "http://en.wikipedia.org/wiki/Bluetooth#Uses", 259 | "url2": "https://learn.sparkfun.com/tutorials/bluetooth-basics/common-versions" 260 | } 261 | }, { 262 | "name": "4.0 + Bluetooth Low Energy (BLE)", 263 | "version": "4.0+BLE", 264 | "max": { 265 | "downlink": 1.0, 266 | "uplink": 1.0 267 | }, 268 | "latencyRange": "3-6", 269 | "ref": { 270 | "url": "http://en.wikipedia.org/wiki/Bluetooth_low_energy" 271 | } 272 | }], 273 | 274 | "ethernet": [{ 275 | "name": "Ethernet", 276 | "version": "10", 277 | "max": { 278 | "downlink": 10.0, 279 | "uplink": 10.0 280 | }, 281 | "latencyRange": "0+", 282 | "ref": { 283 | "url": "http://en.wikipedia.org/wiki/Ethernet" 284 | } 285 | }, { 286 | "name": "Fast Ethernet", 287 | "version": "100", 288 | "max": { 289 | "downlink": 100.0, 290 | "uplink": 100.0 291 | }, 292 | "latencyRange": "0+", 293 | "ref": { 294 | "url": "http://en.wikipedia.org/wiki/Fast_Ethernet" 295 | } 296 | }, { 297 | "name": "Gigabit Ethernet", 298 | "version": "GigE", 299 | "max": { 300 | "downlink": 1000.0, 301 | "uplink": 1000.0 302 | }, 303 | "latencyRange": "0+", 304 | "ref": { 305 | "url": "http://en.wikipedia.org/wiki/Gigabit_Ethernet" 306 | } 307 | }, { 308 | "name": "10-gigabit Ethernet", 309 | "version": "10 GigE", 310 | "max": { 311 | "downlink": 10000.0, 312 | "uplink": 10000.0 313 | }, 314 | "latencyRange": "0+", 315 | "ref": { 316 | "url": "http://en.wikipedia.org/wiki/10-gigabit_Ethernet" 317 | } 318 | }], 319 | 320 | "wifi": [{ 321 | "name": "b", 322 | "version": "802.11b", 323 | "max": { 324 | "downlink": 11.0, 325 | "uplink": 11.0 326 | }, 327 | "latencyRange": "0+", 328 | "ref": { 329 | "url": "http://en.wikipedia.org/wiki/IEEE_802.11#802.11b" 330 | } 331 | }, { 332 | "name": "g", 333 | "version": "802.11g", 334 | "max": { 335 | "downlink": 54.0, 336 | "uplink": 54.0 337 | }, 338 | "latencyRange": "0+", 339 | "ref": { 340 | "url": "http://en.wikipedia.org/wiki/IEEE_802.11#802.11g" 341 | } 342 | }, { 343 | "name": "n", 344 | "version": "802.11n", 345 | "max": { 346 | "downlink": 600.0, 347 | "uplink": 600.0 348 | }, 349 | "latencyRange": "0+", 350 | "ref": { 351 | "url": "http://en.wikipedia.org/wiki/IEEE_802.11#802.11n" 352 | } 353 | }, { 354 | "name": "ac", 355 | "version": "802.11ac", 356 | "max": { 357 | "downlink": 6933.3, 358 | "uplink": 6933.3 359 | }, 360 | "latencyRange": "0+", 361 | "ref": { 362 | "url": "http://www.cisco.com/c/en/us/solutions/collateral/enterprise-networks/802-11ac-solution/q-and-a-c67-734152.html" 363 | } 364 | }, { 365 | "name": "ad", 366 | "version": "802.11ad", 367 | "max": { 368 | "downlink": 7000.0, 369 | "uplink": 7000.0 370 | }, 371 | "latencyRange": "0+", 372 | "ref": { 373 | "url": "http://en.wikipedia.org/wiki/IEEE_802.11#802.11ad" 374 | } 375 | }], 376 | 377 | "unknown": [{ 378 | "name": "unknown", 379 | "version": "unknown", 380 | "max": { 381 | "downlink": "+Infinity", 382 | "uplink": "+Infinity" 383 | } 384 | }], 385 | "none": [{ 386 | "name": "none", 387 | "version": "none", 388 | "max": { 389 | "downlink": 0, 390 | "uplink": 0 391 | } 392 | }], 393 | "other": [{ 394 | "name": "other", 395 | "version": "other", 396 | "max": { 397 | "downlink": "user agent specific.", 398 | "uplink": "user agent specific." 399 | } 400 | }] 401 | } 402 | -------------------------------------------------------------------------------- /examples/example1.html: -------------------------------------------------------------------------------- 1 | 8 | 9 |
This is a free ACME service. However, your operator may 11 | charge you for the amount of data you use. If you are unsure how much data 12 | costs on your tariff, please contact your network operator. 13 | 14 |
15 | 16 |This is a free ACME service. However, your operator may 20 | charge you for the amount of data you use. If you are unsure how much data 21 | costs on your tariff, please contact your network operator. 22 | 23 |
24 | 25 |This is a free ACME service. However, your operator may 28 | charge you for the amount of data you use. If you are unsure how much data 29 | costs on your tariff, please contact your network operator. 30 | 31 |
32 | 33 |139 | // Get the connection type. 140 | var type = navigator.connection.type; 141 | 142 | // Get an upper bound on the downlink speed of the first network hop 143 | var max = navigator.connection.downlinkMax; 144 | 145 | function changeHandler(e) { 146 | // Handle change to connection here. 147 | } 148 | 149 | // Register for event changes. 150 | navigator.connection.onchange = changeHandler; 151 | 152 | // Alternatively. 153 | navigator.connection.addEventListener('change', changeHandler); 154 |155 |
navigator.onLine === false
in HTML.201 | enum ConnectionType { 202 | "bluetooth", 203 | "cellular", 204 | "ethernet", 205 | "mixed", 206 | "none", 207 | "other", 208 | "unknown", 209 | "wifi", 210 | "wimax" 211 | }; 212 |213 | 214 | ### Effective connection types 215 | 216 | This section defines the effective connection types (ECT): 217 | 218 |
ECT | 223 |Minimum RTT (ms) | 224 |Maximum downlink (Kbps) | 225 |Explanation | 226 |
---|---|---|---|
slow-2g | 231 |2000 | 232 |50 | 233 |The network is suited for small transfers only such as text-only pages. | 234 |
2g | 237 |1400 | 238 |70 | 239 |The network is suited for transfers of small images. | 240 |
3g | 243 |270 | 244 |700 | 245 |The network is suited for transfers of large assets such as high resolution images, audio, and SD video. | 246 |
4g | 249 |0 | 250 |∞ | 251 |The network is suited for HD video, real-time video, etc. | 252 |
269 | enum EffectiveConnectionType { 270 | "2g", 271 | "3g", 272 | "4g", 273 | "slow-2g" 274 | }; 275 |276 | 277 | 278 | ## NavigatorNetworkInformation interface 279 | 280 | The
Navigator
and WorkerNavigator
interface expose access to NetworkInformation interface by mixing in NavigatorNetworkInformation.
281 |
282 | 283 | interface mixin NavigatorNetworkInformation { 284 | [SameObject] readonly attribute NetworkInformation connection; 285 | }; 286 | 287 | Navigator includes NavigatorNetworkInformation; 288 | WorkerNavigator includes NavigatorNetworkInformation; 289 |290 | 291 |
connection
attribute
293 |
294 | The connection attribute, when getting, returns an object that implements the NetworkInformation interface.
295 | EventTarget
is defined in [[!DOM]].
301 |
302 | 303 | [Exposed=(Window,Worker)] 304 | interface NetworkInformation : EventTarget { 305 | readonly attribute ConnectionType type; 306 | readonly attribute EffectiveConnectionType effectiveType; 307 | readonly attribute Megabit downlinkMax; 308 | readonly attribute Megabit downlink; 309 | readonly attribute Millisecond rtt; 310 | attribute EventHandler onchange; 311 | }; 312 | 313 | typedef unrestricted double Megabit; 314 | typedef unsigned long long Millisecond; 315 |316 | 317 | This section also defines a number of HTTP request header fields that expose details about the user's network conditions, which servers can opt-into receiving. They can do that via the Client Hints infrastructure defined in [[CLIENT-HINTS]] and bound by the processing model defined in [[CLIENT-HINTS-INFRASTRUCTURE]]. 318 | 319 | ### type attribute 320 | 321 | The type attribute, when getting, returns the connection type that the user agent is using. 322 | 323 | ### effectiveType attribute 324 | 325 | The effectiveType attribute, when getting, returns the effective connection type that is determined using a combination of recently observed rtt and downlink values. 326 | 327 | ####
ECT
Request Header Field
328 |
329 | The ECT request header field is a token that indicates the effectiveType, which is one of EffectiveConnectionType values, at the time when the request is made by the user agent.
330 | It is a Structured Header whose value must be a Token. [[STRUCTURED-HEADERS]]
331 |
332 | ### downlinkMax attribute
333 |
334 | The downlinkMax attribute represents an upper bound on the downlink speed of the first network hop. The reported value is in megabits per second and determined by the properties of the underlying connection technology.
335 |
336 | Connection type | 379 |Underlying connection technology | 380 |Generation or Version | 381 |Max downlink speed (Mbit/s) | 382 |
---|---|---|---|
Data available as JSON. | 388 |