Skip to content

Commit

Permalink
Merge pull request #55 from yadaiio/Improve_documentation
Browse files Browse the repository at this point in the history
Improve documentation
  • Loading branch information
clue committed Feb 11, 2024
2 parents 6e9475c + 81d322c commit b9e1912
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Expand Up @@ -170,6 +170,8 @@ $proxy->connect('tcp://smtp.googlemail.com:587')->then(function (React\Socket\Co
$connection->on('data', function ($chunk) use ($connection) {
echo $chunk;
});
}, function (Exception $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
});
```

Expand All @@ -189,6 +191,8 @@ $connector->connect('tcp://smtp.googlemail.com:587')->then(function (React\Socke
$connection->on('data', function ($chunk) use ($connection) {
echo $chunk;
});
}, function (Exception $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
});
```

Expand All @@ -215,6 +219,8 @@ $connector->connect('tls://smtp.googlemail.com:465')->then(function (React\Socke
$connection->on('data', function ($chunk) use ($connection) {
echo $chunk;
});
}, function (Exception $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
});
```

Expand Down Expand Up @@ -247,7 +253,7 @@ $browser->get('https://example.com/')->then(function (Psr\Http\Message\ResponseI
```

See also [ReactPHP's HTTP client](https://github.com/reactphp/http#client-usage)
and any of the [examples](examples) for more details.
and any of the [examples](examples/) for more details.

#### Connection timeout

Expand Down Expand Up @@ -275,6 +281,8 @@ $connector = new React\Socket\Connector(array(

$connector->connect('tcp://google.com:80')->then(function ($connection) {
// connection succeeded within 3.0 seconds
}, function (Exception $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
});
```

Expand Down Expand Up @@ -412,6 +420,8 @@ $proxy = new Clue\React\HttpProxy\ProxyConnector('http+unix:///tmp/proxy.sock');

$proxy->connect('tcp://google.com:80')->then(function (React\Socket\ConnectionInterface $connection) {
// connected…
}, function (Exception $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
});
```

Expand Down

0 comments on commit b9e1912

Please sign in to comment.