Web APIs
HTTP
Fetch: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch
a better version of XHR
it returns Promise:
fetch(
https://api.github.com/users/${this.name}`) .then(resp => resp.json());`4xx and 5xx are not considerd as error so it's in then
living standard: safari and IE not support it
XMLHttpRequest:
Web Workers
background thread (other than UI thread)
cannot access DOM
different context window
Sevice Worker
Proxy between browser and network. Handles network requests. Thus enabling offline experience.
it's web worker and more
cannot access DOM
Web Socket
Communicate from browser to server.
Socket.IO: A long polling/WebSocket based third party transfer protocol for Node.js.
Last updated