From 161550b2d2fd1a6da90c0b299f0f52b105f33d89 Mon Sep 17 00:00:00 2001 From: Paul Vogel Date: Wed, 6 Jan 2021 18:47:26 +0100 Subject: [PATCH] Update example 63 to support v1.0.0+ Add LoopInterface as first constructor argument to Server and change Server to accept variadic middleware handlers instead of array. --- examples/63-server-streaming-request.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/63-server-streaming-request.php b/examples/63-server-streaming-request.php index 9c1a9758..45eb0dea 100644 --- a/examples/63-server-streaming-request.php +++ b/examples/63-server-streaming-request.php @@ -9,7 +9,8 @@ // Note how this example uses the advanced `StreamingRequestMiddleware` to allow streaming // the incoming HTTP request. This very simple example merely counts the size // of the streaming body, it does not otherwise buffer its contents in memory. -$server = new React\Http\Server(array( +$server = new React\Http\Server( + $loop, new React\Http\Middleware\StreamingRequestMiddleware(), function (Psr\Http\Message\ServerRequestInterface $request) { $body = $request->getBody(); @@ -44,7 +45,7 @@ function (Psr\Http\Message\ServerRequestInterface $request) { }); }); } -)); +); $server->on('error', 'printf');