Skip to content

Commit 8e3cd4f

Browse files
committed
Prepare v0.6.0 release
1 parent 733266b commit 8e3cd4f

File tree

2 files changed

+96
-22
lines changed

2 files changed

+96
-22
lines changed

CHANGELOG.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,59 @@
11
# Changelog
22

3+
## 0.6.0 (2017-02-17)
4+
5+
* Feature / BC break: Use `connect($uri)` instead of `create($host, $port)`
6+
and resolve with a `ConnectionInterface` instead of `Stream`
7+
and expose remote and local addresses through this interface
8+
and remove superfluous and undocumented `ConnectionException`.
9+
(#74, #82 and #84 by @clue)
10+
11+
```php
12+
// old
13+
$connector->create('google.com', 80)->then(function (Stream $conn) {
14+
echo 'Connected' . PHP_EOL;
15+
$conn->write("GET / HTTP/1.0\r\n\r\n");
16+
});
17+
18+
// new
19+
$connector->connect('google.com:80')->then(function (ConnectionInterface $conn) {
20+
echo 'Connected to ' . $conn->getRemoteAddress() . PHP_EOL;
21+
$conn->write("GET / HTTP/1.0\r\n\r\n");
22+
});
23+
```
24+
25+
> Note that both the old `Stream` and the new `ConnectionInterface` implement
26+
the same underlying `DuplexStreamInterface`, so their streaming behavior is
27+
actually equivalent.
28+
In order to upgrade, simply use the new typehints.
29+
Existing stream handlers should continue to work unchanged.
30+
31+
* Feature / BC break: All connectors now MUST offer cancellation support.
32+
You can now rely on getting a rejected promise when calling `cancel()` on a
33+
pending connection attempt.
34+
(#79 by @clue)
35+
36+
```php
37+
// old: promise resolution not enforced and thus unreliable
38+
$promise = $connector->create($host, $port);
39+
$promise->cancel();
40+
$promise->then(/* MAY still be called */, /* SHOULD be called */);
41+
42+
// new: rejecting after cancellation is mandatory
43+
$promise = $connector->connect($uri);
44+
$promise->cancel();
45+
$promise->then(/* MUST NOT be called */, /* MUST be called */);
46+
```
47+
48+
> Note that this behavior is only mandatory for *pending* connection attempts.
49+
Once the promise is settled (resolved), calling `cancel()` will have no effect.
50+
51+
* BC break: All connector classes are now marked `final`
52+
and you can no longer `extend` them
53+
(which was never documented or recommended anyway).
54+
Please use composition instead of extension.
55+
(#85 by @clue)
56+
357
## 0.5.3 (2016-12-24)
458

559
* Fix: Skip IPv6 tests if not supported by the system

README.md

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,35 @@
22

33
[![Build Status](https://secure.travis-ci.org/reactphp/socket-client.png?branch=master)](http://travis-ci.org/reactphp/socket-client) [![Code Climate](https://codeclimate.com/github/reactphp/socket-client/badges/gpa.svg)](https://codeclimate.com/github/reactphp/socket-client)
44

5-
Async Connector to open TCP/IP and SSL/TLS based connections.
5+
Async, streaming plaintext TCP/IP and secure TLS based connections for [ReactPHP](https://reactphp.org/)
66

7-
> The master branch contains the code for the upcoming 0.6 release.
8-
For the code of the current stable 0.5.x release, checkout the
9-
[0.5 branch](https://github.com/reactphp/socket-client/tree/0.5).
10-
11-
## Introduction
12-
13-
Think of this library as an async version of
7+
You can think of this library as an async version of
148
[`fsockopen()`](http://www.php.net/function.fsockopen) or
159
[`stream_socket_client()`](http://php.net/function.stream-socket-client).
16-
17-
Before you can actually transmit and receive data to/from a remote server, you
18-
have to establish a connection to the remote end. Establishing this connection
19-
through the internet/network takes some time as it requires several steps in
20-
order to complete:
21-
22-
1. Resolve remote target hostname via DNS (+cache)
23-
2. Complete TCP handshake (2 roundtrips) with remote target IP:port
24-
3. Optionally enable SSL/TLS on the new resulting connection
10+
If you want to transmit and receive data to/from a remote server, you first
11+
have to establish a connection to the remote end.
12+
Establishing this connection through the internet/network may take some time
13+
as it requires several steps (such as resolving target hostname, completing
14+
TCP/IP handshake and enabling TLS) in order to complete.
15+
This component provides an async version of all this so you can establish and
16+
handle multiple connections without blocking.
17+
18+
**Table of Contents**
19+
20+
* [Usage](#usage)
21+
* [ConnectorInterface](#connectorinterface)
22+
* [connect()](#connect)
23+
* [ConnectionInterface](#connectioninterface)
24+
* [getRemoteAddress()](#getremoteaddress)
25+
* [getLocalAddress()](#getlocaladdress)
26+
* [Plaintext TCP/IP connections](#plaintext-tcpip-connections)
27+
* [DNS resolution](#dns-resolution)
28+
* [Secure TLS connections](#secure-tls-connections)
29+
* [Connection timeout](#connection-timeouts)
30+
* [Unix domain sockets](#unix-domain-sockets)
31+
* [Install](#install)
32+
* [Tests](#tests)
33+
* [License](#license)
2534

2635
## Usage
2736

@@ -170,7 +179,7 @@ If your system has multiple interfaces (e.g. a WAN and a LAN interface),
170179
you can use this method to find out which interface was actually
171180
used for this connection.
172181

173-
### Async TCP/IP connections
182+
### Plaintext TCP/IP connections
174183

175184
The `React\SocketClient\TcpConnector` class implements the
176185
[`ConnectorInterface`](#connectorinterface) and allows you to create plaintext
@@ -271,7 +280,7 @@ $connector = new React\SocketClient\Connector($loop, $dns);
271280
$connector->connect('www.google.com:80')->then($callback);
272281
```
273282

274-
### Async SSL/TLS connections
283+
### Secure TLS connections
275284

276285
The `SecureConnector` class implements the
277286
[`ConnectorInterface`](#connectorinterface) and allows you to create secure
@@ -383,15 +392,26 @@ The recommended way to install this library is [through Composer](http://getcomp
383392
This will install the latest supported version:
384393

385394
```bash
386-
$ composer require react/socket-client:^0.5.3
395+
$ composer require react/socket-client:^0.6
387396
```
388397

389398
More details about version upgrades can be found in the [CHANGELOG](CHANGELOG.md).
390399

391400
## Tests
392401

393-
To run the test suite, you need PHPUnit. Go to the project root and run:
402+
To run the test suite, you first need to clone this repo and then install all
403+
dependencies [through Composer](http://getcomposer.org):
404+
405+
```bash
406+
$ composer install
407+
```
408+
409+
To run the test suite, go to the project root and run:
394410

395411
```bash
396-
$ phpunit
412+
$ php vendor/bin/phpunit
397413
```
414+
415+
## License
416+
417+
MIT, see [LICENSE file](LICENSE).

0 commit comments

Comments
 (0)