phasync
ServerSentEvents / __construct

Method

ServerSentEvents::__construct

Send the head of the stream.

Description#

public ServerSentEvents::__construct(
    ClientRequest $request,
    array $headers = []
)

A HEAD request gets the head and an empty body, and send() and comment() throw IOException: there is no stream.

Parameters#

$request ClientRequest
The exchange to stream on
$headers array = []
More response headers, such as access-control-allow-origin

Errors / Exceptions#

ExceptionWhen
HeadersSentExceptionWhen the request has a response head already