Skip to content

Commit 946dbc1

Browse files
committed
Document connector interface
1 parent ed41caa commit 946dbc1

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ $loop->start();
3737
The `Socks/Client` uses a [Promise](https://github.com/reactphp/promise)-based interface which makes working with asynchronous functions a breeze.
3838
Let's open up a TCP [Stream](https://github.com/reactphp/stream) connection and write some data:
3939
```PHP
40-
$client->getConnection('www.google.com',80)->then(function (React\Stream\Stream $stream) {
40+
$tcp = $client->createConnector();
41+
42+
$tcp->create('www.google.com',80)->then(function (React\Stream\Stream $stream) {
4143
echo 'connected to www.google.com:80';
4244
$stream->write("GET / HTTP/1.0\r\n\r\n");
4345
// ...
@@ -67,10 +69,10 @@ Yes, this works for both plain HTTP and SSL encrypted HTTPS requests.
6769

6870
If you want to connect to arbitrary SSL/TLS servers, there sure too is an easy to use API available:
6971
```PHP
70-
$ssl = $client->createSecureConnectionManager();
72+
$ssl = $client->createSecureConnector();
7173

72-
// now create an SSL encrypted connection (notice the $ssl instead of $client)
73-
$ssl->getConnection('www.google.com',443)->then(function (React\Stream\Stream $stream) {
74+
// now create an SSL encrypted connection (notice the $ssl instead of $tcp)
75+
$ssl->create('www.google.com',443)->then(function (React\Stream\Stream $stream) {
7476
// proceed with just the plain text data and everything is encrypted/decrypted automatically
7577
echo 'connected to SSL encrypted www.google.com';
7678
$stream->write("GET / HTTP/1.0\r\n\r\n");

0 commit comments

Comments
 (0)