Skip to content

Commit 7dc5721

Browse files
authored
Merge pull request #89 from clue-labs/stream
Forward compatibility with Stream v0.5 and upcoming v0.6
2 parents 8e3cd4f + 1fce343 commit 7dc5721

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,18 @@ you can use any of its events and methods as usual:
116116

117117
```php
118118
$connection->on('data', function ($chunk) {
119-
echo $data;
119+
echo $chunk;
120120
});
121121

122-
$conenction->on('close', function () {
122+
$connection->on('end', function () {
123+
echo 'ended';
124+
});
125+
126+
$connection->on('error', function (Exception $e) {
127+
echo 'error: ' . $e->getMessage();
128+
});
129+
130+
$connection->on('close', function () {
123131
echo 'closed';
124132
});
125133

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"php": ">=5.3.0",
88
"react/dns": "0.4.*|0.3.*",
99
"react/event-loop": "0.4.*|0.3.*",
10-
"react/stream": "^0.4.5",
10+
"react/stream": "^0.6 || ^0.5 || ^0.4.5",
1111
"react/promise": "^2.1 || ^1.2",
1212
"react/promise-timer": "~1.0"
1313
},

src/ConnectionInterface.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,18 @@
2929
*
3030
* ```php
3131
* $connection->on('data', function ($chunk) {
32-
* echo $data;
32+
* echo $chunk;
3333
* });
3434
*
35-
* $conenction->on('close', function () {
35+
* $connection->on('end', function () {
36+
* echo 'ended';
37+
* });
38+
*
39+
* $connection->on('error', function (Exception $e) {
40+
* echo 'error: ' . $e->getMessage();
41+
* });
42+
*
43+
* $connection->on('close', function () {
3644
* echo 'closed';
3745
* });
3846
*

0 commit comments

Comments
 (0)