I am working on web performance and I have to communicate with a remote server via Http protocol. The thing I want to do is getting the TTFB (Time To First Byte)** using the Http tools (HttpClient/Response/Handler/Interceptor…) from the Apache API or Android API, or from another lib/api working on Android.
Is there a way to do that with these class ? I have watched the web/forums until now, and all the subjects I’ve found are about reducing the TTFB, but never on how I can get it.
Any help would be appreciated 🙂
Thanks in advance, and I hope my English is understandable 🙂
Regards
** : corresponding to the delay between the end of a request and receiving a response, as we’re talking about the web here it will be when the browser received the first byte.
W3C has a proposed recommendation on Navigation Timing.
The PerformanceTiming interface exposes a responseStart attribute, which is required to “return the time immediately after the user agent receives the first byte of the response from the server, or from relevant application caches or from local resources.”
I think TTFB would be equal to
but I could be wrong about that. The linked document includes a working html + javascript example.