Skip to content

Commit 1645f0c

Browse files
committed
Show streaming in Terminal
1 parent 3c3536d commit 1645f0c

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

README.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ Any non-string arguments passed will be converted to string using `util.Objects:
8787
This library supports AWS Lambda response streaming as [announced by AWS in April 2023](https://aws.amazon.com/de/blogs/compute/introducing-aws-lambda-response-streaming/). To use the stream, return a `function(var, Stream, Context)` from the handler's *target()* method instead of a `function(var, Context)`:
8888

8989
```php
90-
use com\amazon\aws\lambda\Handler;
90+
use com\amazon\aws\lambda\{Context, Handler, Stream};
9191

9292
class Streamed extends Handler {
9393

9494
public function target(): callable {
95-
return function($event, $stream, $context) {
95+
return function($event, Stream $stream, Context $context) {
9696
$stream->use('text/plain');
9797
$stream->write("[".date('r')."] Hello world...\n");
9898

@@ -105,16 +105,9 @@ class Streamed extends Handler {
105105
}
106106
```
107107

108-
The stream API is defined as follows:
108+
Invoking this lambda will yield the following:
109109

110-
```php
111-
public interface com.amazon.aws.lambda.Stream {
112-
public abstract function transmit(io.Channel|io.streams.InputStream $source, string $mimeType): void
113-
public abstract function use(string $mimeType): void
114-
public abstract function write(string $bytes): void
115-
public abstract function end(): void
116-
}
117-
```
110+
![Streaming in Terminal](https://github.com/xp-forge/lambda/assets/696742/41785beb-3903-45a0-a2ec-2c7c27c2c7b4)
118111

119112
Development
120113
-----------

0 commit comments

Comments
 (0)