class IterableStreamedResponse extends StreamedResponse

Retain iterable chunks so the Swoole bridge can stop production after a failed write.

Properties

protected bool $cancelOnDisconnect

Methods

__construct(iterable $chunks, int $status = 200, array $headers = [])

Create a new iterable streamed response.

cancelOnDisconnect(bool $cancel = true)

Cancel response production when the client connection closes.

bool
shouldCancelOnDisconnect()

Determine whether disconnects should cancel response production.

setChunks(iterable $chunks)

Set the chunks associated with the response.

setCallback(callable $callback)

Set the callback associated with the response.

sendContent()

Send the response content.

bool
streamTo(Closure $write)

Stream retained chunks through the given writer.

Details

at line 29
__construct(iterable $chunks, int $status = 200, array $headers = [])

Create a new iterable streamed response.

Parameters

iterable $chunks
int $status
array $headers

at line 39
IterableStreamedResponse cancelOnDisconnect(bool $cancel = true)

Cancel response production when the client connection closes.

Parameters

bool $cancel

Return Value

IterableStreamedResponse

at line 49
bool shouldCancelOnDisconnect()

Determine whether disconnects should cancel response production.

Return Value

bool

at line 59
IterableStreamedResponse setChunks(iterable $chunks)

Set the chunks associated with the response.

Parameters

iterable $chunks

Return Value

IterableStreamedResponse

at line 70
IterableStreamedResponse setCallback(callable $callback)

Set the callback associated with the response.

Parameters

callable $callback

Return Value

IterableStreamedResponse

at line 81
IterableStreamedResponse sendContent()

Send the response content.

at line 108
bool streamTo(Closure $write)

internal  
 

Stream retained chunks through the given writer.

Parameters

Closure $write

Return Value

bool