Skip to content

Commit

Permalink
Update readme with connection pooling and timing+connection metadata …
Browse files Browse the repository at this point in the history
…details
  • Loading branch information
lucasnetau committed Oct 12, 2024
1 parent 588edbf commit b9b9f36
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Implementation of an Async HTTP client using CURL.
*** NOTE *** This is a work in progress, Not 100% compatible replacement for ReactPHP Browser

## Why not use package react/http Browser?
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
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

## Requirements

Expand Down Expand Up @@ -35,6 +35,34 @@ $browser = new Browser([
]);
```

### Connection Reuse
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.

## Connection Metadata
### Connection Timing
The request/response timing is provided though the header '`ServerTiming`' in the Response object.

Each timing point is defined as `<timing point>;dur=<duration in second>`

* namelookup_time
* connect_time
* appconnect_time
* pretransfer_time
* redirect_time
* starttransfer_time
* total_time

### Connection Details
Additional request/response metadata is provided though the header '`X-Connection`' in the Response object.

Key/Value pairs are as follows:

* effective_url=`<final url after any redirects>`
* connection;count=`<number of connections opened during the request, 0 if existing connection reused>`
* redirect;count=`<number of redirects followed>`
* upload;size=`<bytes sent in request(headers+body) including redirects>`;speed=`<overall bytes per second upload>`
* download;size=`<bytes received in response(headers+body) including redirects>`;speed=`<overall bytes per second download>`

## License

MIT, see [LICENSE file](LICENSE).
Expand Down

0 comments on commit b9b9f36

Please sign in to comment.