Skip to content

Commit b9b9f36

Browse files
committed
Update readme with connection pooling and timing+connection metadata details
1 parent 588edbf commit b9b9f36

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Implementation of an Async HTTP client using CURL.
44
*** NOTE *** This is a work in progress, Not 100% compatible replacement for ReactPHP Browser
55

66
## Why not use package react/http Browser?
7-
Using cURL allows for HTTP/2+3, and the extraction of timing data for the requests. This functionality is not available though the ReactPHP Browser implementation
7+
Using cURL allows for HTTP/2+3, connection pooling (with keep-alive), and the extraction of timing data for the requests. This functionality is not available though the ReactPHP Browser implementation
88

99
## Requirements
1010

@@ -35,6 +35,34 @@ $browser = new Browser([
3535
]);
3636
```
3737

38+
### Connection Reuse
39+
Each instance of Browser shares a Connection pool, DNS cache, SSL cache, and Cookie Jar. An example of this can be seen in [/examples/connection_pooling.php](/examples/connection_pooling.php) script.
40+
41+
## Connection Metadata
42+
### Connection Timing
43+
The request/response timing is provided though the header '`ServerTiming`' in the Response object.
44+
45+
Each timing point is defined as `<timing point>;dur=<duration in second>`
46+
47+
* namelookup_time
48+
* connect_time
49+
* appconnect_time
50+
* pretransfer_time
51+
* redirect_time
52+
* starttransfer_time
53+
* total_time
54+
55+
### Connection Details
56+
Additional request/response metadata is provided though the header '`X-Connection`' in the Response object.
57+
58+
Key/Value pairs are as follows:
59+
60+
* effective_url=`<final url after any redirects>`
61+
* connection;count=`<number of connections opened during the request, 0 if existing connection reused>`
62+
* redirect;count=`<number of redirects followed>`
63+
* upload;size=`<bytes sent in request(headers+body) including redirects>`;speed=`<overall bytes per second upload>`
64+
* download;size=`<bytes received in response(headers+body) including redirects>`;speed=`<overall bytes per second download>`
65+
3866
## License
3967

4068
MIT, see [LICENSE file](LICENSE).

0 commit comments

Comments
 (0)