mirror of
https://github.com/danog/amp.git
synced 2024-11-26 20:15:00 +01:00
Fix cancellation token example
This commit is contained in:
parent
fdf18dedd7
commit
39dd36efdc
@ -19,9 +19,10 @@ use function Amp\Promise\rethrow;
|
||||
* **Example**
|
||||
*
|
||||
* ```php
|
||||
* $cancellationTokenSource = new CancellationTokenSource;
|
||||
* $tokenSource = new CancellationTokenSource;
|
||||
* $token = $tokenSource->getToken();
|
||||
*
|
||||
* $response = yield $httpClient->request("https://example.com/stream");
|
||||
* $response = yield $httpClient->request("https://example.com/stream", $token);
|
||||
* $responseBody = $response->getBody();
|
||||
*
|
||||
* while (($chunk = yield $response->read()) !== null) {
|
||||
|
Loading…
Reference in New Issue
Block a user