From 7fc60547bcd7cc0e5b2649ef848c81f2b95be58f Mon Sep 17 00:00:00 2001 From: Simon Frings Date: Thu, 5 Aug 2021 10:47:08 +0200 Subject: [PATCH] Simplify usage by supporting new Socket API --- README.md | 7 ++++--- composer.json | 2 +- src/Factory.php | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0cc11c8..07fb1a3 100644 --- a/README.md +++ b/README.md @@ -97,11 +97,12 @@ here in order to use the [default loop](https://github.com/reactphp/event-loop#l This value SHOULD NOT be given unless you're sure you want to explicitly use a given event loop instance. -If you need custom DNS, proxy or TLS settings, you can explicitly pass a -custom instance of the [`ConnectorInterface`](https://github.com/reactphp/socket#connectorinterface): +If you need custom connector settings (DNS resolution, TLS parameters, timeouts, +proxy servers etc.), you can explicitly pass a custom instance of the +[`ConnectorInterface`](https://github.com/reactphp/socket#connectorinterface): ```php -$connector = new React\Socket\Connector(null, array( +$connector = new React\Socket\Connector(array( 'dns' => '127.0.0.1', 'tcp' => array( 'bindto' => '192.168.10.1:0' diff --git a/composer.json b/composer.json index 8f4dde6..3f8c7af 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "react/event-loop": "^1.2", "react/promise": "^2.0 || ^1.1", "react/promise-timer": "^1.5", - "react/socket": "^1.8" + "react/socket": "^1.9" }, "require-dev": { "clue/block-react": "^1.1", diff --git a/src/Factory.php b/src/Factory.php index aec03da..90706d3 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -31,7 +31,7 @@ class Factory public function __construct(LoopInterface $loop = null, ConnectorInterface $connector = null, ProtocolFactory $protocol = null) { $this->loop = $loop ?: Loop::get(); - $this->connector = $connector ?: new Connector($this->loop); + $this->connector = $connector ?: new Connector(array(), $this->loop); $this->protocol = $protocol ?: new ProtocolFactory(); }