/** * @param string $data * @return Observable */ public function write($data) { $buffer = new Buffer($this->socket, $this->loop, $data); // Write error close the stream $buffer->subscribeCallback(null, [$this, "close"], null, new EventLoopScheduler($this->loop)); return $buffer; }
/** * @param string $data * @return Observable */ public function write($data) { $buffer = new Buffer($this->socket, $this->loop, $data); // Write error close the stream, write completed wait for data $buffer->subscribeCallback(null, [$this, "close"], function () { $this->loop->addReadStream($this->socket, array($this, 'read')); }); return $buffer; }