<?php namespace React\Socket; /** * The `ConnectorInterface` is responsible for providing an interface for * establishing streaming connections, such as a normal TCP/IP connection. * * This is the main interface defined in this package and it is used throughout * React's vast ecosystem. * * Most higher-level components (such as HTTP, database or other networking * service clients) accept an instance implementing this interface to create their * TCP/IP connection to the underlying networking service. * This is usually done via dependency injection, so it's fairly simple to actually * swap this implementation against any other implementation of this interface. * * The interface only offers a single `connect()` method. * * @see ConnectionInterface */ interface ConnectorInterface { /** * Creates a streaming connection to the given remote address * * If returns a Promise which either fulfills with a stream implementing * `ConnectionInterface` on success or rejects with an `Exception` if the * connection is not successful. * * ```php * $connector->connect('google.com:443')->then( * function (ConnectionInterface $connection) { * // connection successfully established * }, * function (Exception $error) { * // failed to connect due to $error * } * ); * ``` * * The returned Promise MUST be implemented in such a way that it can be * cancelled when it is still pending. Cancelling a pending promise MUST * reject its value with an Exception. It SHOULD clean up any underlying * resources and references as applicable. * * ```php * $promise = $connector->connect($uri); * * $promise->cancel(); * ``` * * @param string $uri * @return \React\Promise\PromiseInterface resolves with a stream implementing ConnectionInterface on success or rejects with an Exception on error * @see ConnectionInterface */ public function connect($uri); }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Connection.php | File | 5.61 KB | 0644 |
|
ConnectionInterface.php | File | 4.32 KB | 0644 |
|
Connector.php | File | 4.2 KB | 0644 |
|
ConnectorInterface.php | File | 2.01 KB | 0644 |
|
DnsConnector.php | File | 3.6 KB | 0644 |
|
FixedUriConnector.php | File | 1.02 KB | 0644 |
|
LimitingServer.php | File | 6.39 KB | 0644 |
|
SecureConnector.php | File | 2.21 KB | 0644 |
|
SecureServer.php | File | 6.45 KB | 0644 |
|
Server.php | File | 1.83 KB | 0644 |
|
ServerInterface.php | File | 5.13 KB | 0644 |
|
StreamEncryption.php | File | 4.69 KB | 0644 |
|
TcpConnector.php | File | 4.16 KB | 0644 |
|
TcpServer.php | File | 7.39 KB | 0644 |
|
TimeoutConnector.php | File | 570 B | 0644 |
|
UnixConnector.php | File | 1.11 KB | 0644 |
|
UnixServer.php | File | 3.48 KB | 0644 |
|