Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
## 0.3.0 (2013-06-24)

* BC break: Switch from (deprecated) `clue/connection-manager` to `react/socket-client`
and thus replace each occurance of `getConnect($host, $port)` with `create($host, $port)`
and thus replace each occurrence of `getConnect($host, $port)` with `create($host, $port)`
(#1)

* Fix: Timeouts in `ConnectionManagerTimeout` now actually work
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Let's take these projects to the next level together! 🚀

## Introduction

If you're not already familar with [react/socket](https://github.com/reactphp/socket),
If you're not already familiar with [react/socket](https://github.com/reactphp/socket),
think of it as an async (non-blocking) version of [`fsockopen()`](https://www.php.net/manual/en/function.fsockopen.php)
or [`stream_socket_client()`](https://www.php.net/manual/en/function.stream-socket-client.php).
I.e. before you can send and receive data to/from a remote server, you first have to establish a connection - which
Expand All @@ -53,10 +53,9 @@ $connector->connect('www.google.com:80')->then(function ($stream) {
echo 'connection successfully established';
$stream->write("GET / HTTP/1.0\r\nHost: www.google.com\r\n\r\n");
$stream->end();
}, function ($exception) {
echo 'connection attempt failed: ' . $exception->getMessage();
}, function (Exception $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
});

```

Because everything uses the same simple API, the resulting `Connector` classes can be easily interchanged
Expand Down Expand Up @@ -87,6 +86,8 @@ $connectorRepeater = new ConnectionManagerRepeat($connector, 3);
$connectorRepeater->connect('www.google.com:80')->then(function ($stream) {
echo 'connection successfully established';
$stream->close();
}, function (Exception $e) {
echo 'Error: ' . $e->getMessage() . PHP_EOL;
});
```

Expand Down