Amp\Artax\HttpSocketPool class HttpSocketPool implements Amp\Socket\SocketPool

Summary

Properties

Methods

Properties

Methods

__construct — public function __construct(Amp\Socket\SocketPool $sockPool = null, Amp\Artax\HttpTunneler $tunneler = null)
No documentation.
Type Parameter Description Default Value
Amp\Socket\SocketPool $sockPool No documentation. null
Amp\Artax\HttpTunneler $tunneler No documentation. null
checkout — public function checkout(string $uri, Amp\CancellationToken $cancellationToken = null): Amp\Promise

Checkout a socket from the specified URI authority.

The resulting socket resource should be checked back in via SocketPool::checkin() once the calling code is finished with the stream (even if the socket has been closed). Failure to checkin sockets will result in memory leaks and socket queue blockage. Instead of checking the socket in again, it can also be cleared.

Type Parameter Description Default Value
string $uri A string of the form tcp://example.com:80 or tcp://192.168.1.1:443. none
Amp\CancellationToken $cancellationToken Optional cancellation token to cancel the checkout request. null
checkin — public function checkin(Amp\Socket\ClientSocket $socket)

Return a previously checked-out socket to the pool so it can be reused.

Type Parameter Description Default Value
Amp\Socket\ClientSocket $socket Socket instance. none
clear — public function clear(Amp\Socket\ClientSocket $socket)

Remove the specified socket from the pool.

Type Parameter Description Default Value
Amp\Socket\ClientSocket $socket Socket instance. none
setOption — public function setOption(string $option, $value)
No documentation.
Type Parameter Description Default Value
string $option No documentation. none
mixed $value No documentation. none