connection->getSocket(); $socket->header('Content-Type', 'text/event-stream; charset=utf-8'); $socket->header('Transfer-Encoding', 'chunked'); $socket->header('Cache-Control', 'no-cache'); foreach ($response?->getHeaders() ?? [] as $name => $values) { $socket->header($name, implode(', ', $values)); } } public function write(string $data): self { $this->connection->write($data); return $this; } public function end(): void { $this->connection->end(); } }