diff options
author | Valery Piashchynski <[email protected]> | 2022-03-23 20:38:36 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2022-03-23 20:38:36 +0100 |
commit | c9fddf54ab3d02eb02be3013a22af0ac2547f57e (patch) | |
tree | 4b14f1532b681c51f2b6ac3c1849a63367ddff4c | |
parent | 49ca68b8011d8e7bb72f8220b546dcea25ceeb6f (diff) | |
parent | dedc4972187dab09b1e0e37c10ff1fe8c0380582 (diff) |
[#1068]: release: `v2.9.0-alpha.1`v2.9.0-alpha.1
-rw-r--r-- | CHANGELOG.md | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 0001cfae..91ddce49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,60 @@ ## ๐ New: +- โ๏ธ **[ALPHA]** HTTP response streaming. Starting from the `v2.9.0` RR is capable to stream responses. +To turn on that feature, please, add the following lines to the configuration: +```yaml +experimental: + response_streams: true +``` + +Worker sample: +```php +<?php + +use Nyholm\Psr7\Factory\Psr17Factory; +use Nyholm\Psr7\Response; +use Nyholm\Psr7\Stream; +use Spiral\RoadRunner; + +ini_set('display_errors', 'stderr'); +require __DIR__ . "/vendor/autoload.php"; + +$worker = RoadRunner\Worker::create(); +$psr7 = new RoadRunner\Http\PSR7Worker( + $worker, + new Psr17Factory(), + new Psr17Factory(), + new Psr17Factory() +); + +$psr7->chunk_size = 10 * 10 * 1024; +$filename = 'file.tmp'; // big file or response + +while ($req = $psr7->waitRequest()) { + try { + $fp = \fopen($filename, 'rb'); + \flock($fp, LOCK_SH); + $resp = (new Response())->withBody(Stream::create($fp)); + $psr7->respond($resp); + } catch (\Throwable $e) { + $psr7->getWorker()->error((string)$e); + } + +``` + +Known issues: +1. RR will not notify a worker if HTTP connection was interrupted. RR will read all response from the worker and drop it. That will be fixed in the stable streaming release. +2. Sometimes RR may miss the immediate error from the worker and send a 0 payload with 200 status. This is related only to the http response. + - โ๏ธ [**API**](https://github.com/roadrunner-server/api): add service proto api to manage services, [FR](https://github.com/roadrunner-server/roadrunner/issues/1009) (reporter @butschster) -- + +## ๐งน Chore: + +- ๐งโ๐ญ Update all dependencies to the most recent versions. + +--- + ## v2.8.5 (23.03.2022) ## ๐งน Chore: |