@@ -18,7 +18,7 @@ This interface provides a single promise-based method `create($host, $ip)` which
1818when the connection is successfully established or the ` Connector ` gives up and the connection fails.
1919
2020``` php
21- $connectionManager ->create('www.google.com', 80)->then(function ($stream) {
21+ $connector ->create('www.google.com', 80)->then(function ($stream) {
2222 echo 'connection successfully established';
2323 $stream->write("GET / HTTP/1.0\r\nHost: www.google.com\r\n\r\n");
2424 $stream->end();
@@ -38,52 +38,52 @@ any combination thereof.
3838
3939This section lists all this libraries' features along with some examples.
4040The examples assume you've [ installed] ( #install ) this library and
41- already [ set up a ` SocketClient/Connector ` instance ` $connectionManager ` ] ( https://github.com/reactphp/socket-client#async-tcpip-connections ) .
41+ already [ set up a ` SocketClient/Connector ` instance ` $connector ` ] ( https://github.com/reactphp/socket-client#async-tcpip-connections ) .
4242
4343All classes are located in the ` ConnectionManager\Extra ` namespace.
4444
4545### Repeat
4646
47- The ` ConnectionManagerRepeat($connectionManager , $repeat) ` retries connecting to the given location up to a maximum
47+ The ` ConnectionManagerRepeat($connector , $repeat) ` retries connecting to the given location up to a maximum
4848of ` $repeat ` times when the connection fails.
4949
5050``` php
51- $connectionManagerRepeater = new \ConnectionManager\Extra\ConnectionManagerRepeat($connectionManager , 3);
52- $connectionManagerRepeater ->create('www.google.com', 80)->then(function ($stream) {
51+ $connectorRepeater = new \ConnectionManager\Extra\ConnectionManagerRepeat($connector , 3);
52+ $connectorRepeater ->create('www.google.com', 80)->then(function ($stream) {
5353 echo 'connection successfully established';
5454 $stream->close();
5555});
5656```
5757
5858### Timeout
5959
60- The ` ConnectionManagerTimeout($connectionManager , $timeout) ` sets a maximum ` $timeout ` in seconds on when to give up
60+ The ` ConnectionManagerTimeout($connector , $timeout) ` sets a maximum ` $timeout ` in seconds on when to give up
6161waiting for the connection to complete.
6262
6363### Delay
6464
65- The ` ConnectionManagerDelay($connectionManager , $delay) ` sets a fixed initial ` $delay ` in seconds before actually
65+ The ` ConnectionManagerDelay($connector , $delay) ` sets a fixed initial ` $delay ` in seconds before actually
6666trying to connect. (Not to be confused with [ ` ConnectionManagerTimeout ` ] ( #timeout ) which sets a _ maximum timeout_ .)
6767
6868### Reject
6969
7070The ` ConnectionManagerReject() ` simply rejects every single connection attempt.
71- This is particularly useful for the below [ ` ConnectionManagerSelective ` ] [ #selective ] to reject connection attempts
71+ This is particularly useful for the below [ ` ConnectionManagerSelective ` ] ( #selective ) to reject connection attempts
7272to only certain destinations (for example blocking advertisements or harmful sites).
7373
7474### Swappable
7575
76- The ` ConnectionManagerSwappable($connectionManager ) ` is a simple decorator for other ` ConnectionManager ` s to
77- simplify exchanging the actual ` ConnectionManager ` during runtime (` ->setConnectionManager($connectionManager ) ` ).
76+ The ` ConnectionManagerSwappable($connector ) ` is a simple decorator for other ` ConnectionManager ` s to
77+ simplify exchanging the actual ` ConnectionManager ` during runtime (` ->setConnectionManager($connector ) ` ).
7878
7979### Consecutive
8080
81- The ` ConnectionManagerConsecutive($connectionManagers ) ` establishs connections by trying to connect through
81+ The ` ConnectionManagerConsecutive($connectors ) ` establishs connections by trying to connect through
8282any of the given ` ConnectionManager ` s in consecutive order until the first one succeeds.
8383
8484### Random
8585
86- The ` ConnectionManagerRandom($connectionManagers ) ` works much like ` ConnectionManagerConsecutive ` but instead
86+ The ` ConnectionManagerRandom($connectors ) ` works much like ` ConnectionManagerConsecutive ` but instead
8787of using a fixed order, it always uses a randomly shuffled order.
8888
8989### Selective
@@ -93,8 +93,10 @@ those besed on lists similar to to firewall or networking access control lists (
9393
9494This allows fine-grained control on how to handle outgoing connections, like rejecting advertisements,
9595delaying HTTP requests, or forwarding HTTPS connection through a foreign country.
96- ` ->addConnectionManagerFor($connectionManager, $targetHost, $targetPort, $priority) `
9796
97+ ``` php
98+ $connectorSelective->addConnectionManagerFor($connector, $targetHost, $targetPort, $priority);
99+ ```
98100
99101## Install
100102
0 commit comments