Skip to content

Commit

Permalink
fix SSE
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed Feb 28, 2023
1 parent 40a03e1 commit d7faa9c
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -1111,28 +1111,14 @@ function () {
*/
protected function outputResponseRaw(string $data): void
{
/* $isCli = \PHP_SAPI === 'cli'; // for phpunit
// TODO hack for SSE
// https://github.com/atk4/ui/pull/1706#discussion_r757819527
if (headers_sent() && $this->response->getHeaderLine('Content-Type') === 'text/event-stream') {
echo $data;

if (count($headersNew) > 0 && headers_sent() && !$isCli) {
$lateError = new LateOutputError('Headers already sent, more headers cannot be set at this stage');
if ($this->catchExceptions) {
$this->caughtException($lateError);
$this->outputLateOutputError($lateError);
}
throw $lateError;
return;
}

if (!headers_sent() || $isCli) {
foreach ($this->response->getHeaders() as $name => $values) {
foreach ($values as $value) {
if (!$isCli) {
header($name . ': ' . $value, false);
}
}
}
} */

$this->response->getBody()->write($data);

$this->emitResponse();
Expand Down

0 comments on commit d7faa9c

Please sign in to comment.