Skip to content

Commit 654dccb

Browse files
committed
Forward compatibility with Stream v0.5 and upcoming v0.6
1 parent 8e3cd4f commit 654dccb

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,15 @@ $connection->on('data', function ($chunk) {
119119
echo $data;
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: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@
3232
* echo $data;
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy