I want to know if a request between a JavaScript Client and Node.js server is performed using HTTP1.x or HTTP2.
How I know in XMLHttpRequest, Chrome Console and Node.js what type of protocol is used ?
Standard one: performance.timing.nextHopProtocol
Non standard implemetation: window.chrome.loadTimes().connectionInfo
You can check in network tab of dev tools where h2 represents HTTP2,
When the Protocol column says h2 it means that the resource was sent with HTTP/2. The Protocol column is hidden by default. Right-click the table header and select Protocol to show it. See Show more information for an example.
HTTP/1.1orHTTP/2in the request headers. You can also usecurl.express.