protected function saveTo() { $saveTo = $this->options['sink']; $writeStream = fopen($saveTo, 'w'); stream_set_blocking($writeStream, 0); $saveToStream = new ReactStream($writeStream, $this->loop); $saveToStream->on('end', function () { $this->onEnd(); }); $this->httpResponse->pipe($saveToStream); }