Time to First Byte

Time to First Byte (TTFB) is the interval between a browser's request for a page and the arrival of the first byte of data from the server.

It covers DNS lookup, the TCP handshake, and, for HTTPS requests, the TLS handshake as well. In other words, TTFB measures, in milliseconds, the gap between when a request begins and when the response begins.

After calculating TTFB, the system adds it to the performance payload.

For TTFB, add the following code:
ttfb = navEntry.responseStart;
Add the performance payload in timing:
queueEvent.performance.timing.ttfb = getTTFB(timing);