Amp\Artax\IteratorWriter::write PHP Method

write() public method

Write iterator content to the socket.
public write ( resource $socket, mixed $iterator ) : Amp\Promise
$socket resource
$iterator mixed
return Amp\Promise
    public function write($socket, $iterator)
    {
        if (!$iterator->valid()) {
            return new Success();
        }
        $this->socket = $socket;
        $this->iterator = $iterator;
        $this->promisor = new Deferred();
        $this->writeNextElement();
        return $this->promisor->promise();
    }