Skip to content

Commit 8af6086

Browse files
committed
Consistent event semantics for duplex streams
1 parent 2c323a8 commit 8af6086

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ descriptor based implementation with an in-memory write buffer.
3232
* [write()](#write)
3333
* [end()](#end)
3434
* [close()](#close-1)
35+
* [DuplexStreamInterface](#duplexstreaminterface)
3536
* [Usage](#usage)
3637
* [Install](#install)
3738

@@ -672,6 +673,23 @@ how the readable side of the stream also implements a `close()` method.
672673
In other words, after calling this method, the stream MUST switch into
673674
non-writable AND non-readable mode, see also `isReadable()`.
674675

676+
### DuplexStreamInterface
677+
678+
The `DuplexStreamInterface` is responsible for providing an interface for
679+
duplex streams (both readable and writable).
680+
681+
It builds on top of the existing interfaces for readable and writable streams
682+
and follows the exact same method and event semantics.
683+
If you're new to this concept, you should look into the
684+
`ReadableStreamInterface` and `WritableStreamInterface` first.
685+
686+
Besides defining a few methods, this interface also implements the
687+
`EventEmitterInterface` which allows you to react to the same events defined
688+
on the `ReadbleStreamInterface` and `WritableStreamInterface`.
689+
690+
See also [`ReadableStreamInterface`](#readablestreaminterface) and
691+
[`WritableStreamInterface`](#writablestreaminterface) for more details.
692+
675693
## Usage
676694
```php
677695
$loop = React\EventLoop\Factory::create();

src/DuplexStreamInterface.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,22 @@
22

33
namespace React\Stream;
44

5+
/**
6+
* The `DuplexStreamInterface` is responsible for providing an interface for
7+
* duplex streams (both readable and writable).
8+
*
9+
* It builds on top of the existing interfaces for readable and writable streams
10+
* and follows the exact same method and event semantics.
11+
* If you're new to this concept, you should look into the
12+
* `ReadableStreamInterface` and `WritableStreamInterface` first.
13+
*
14+
* Besides defining a few methods, this interface also implements the
15+
* `EventEmitterInterface` which allows you to react to the same events defined
16+
* on the `ReadbleStreamInterface` and `WritableStreamInterface`.
17+
*
18+
* @see ReadableStreamInterface
19+
* @see WritableStreamInterface
20+
*/
521
interface DuplexStreamInterface extends ReadableStreamInterface, WritableStreamInterface
622
{
723
}

0 commit comments

Comments
 (0)