phasync\Psr\UnbufferedStream
class
Documentation
Unbuffered streaming PSR-7 StreamInterface
Designed for returning a response which has not been completed yet. A coroutine can continue appending to the stream.
Usage:
$s = new UnbufferedStream();
// Create a coroutine which appends to the stream
phasync::go(function() use ($s) {
// Append chunks as much as you need
$s->append("A chunk");
// Signal that the stream is complete
$s->end();
});
// Return the stream
return $response->withStream($s);
By default the stream will buffer up to 64 KB of data, to improve performance and reduce context switching.
Inheritance
Implements:
Psr\Http\Message\StreamInterface
Stringable
Properties (11)
string $buffer
The string buffer
int $bufferSize
int $readOffset
float $deadlockTimeout
bool $closed
bool $ended
bool $locked
bool $detached
WeakReference $creator
object $readFlag
object $writeFlag
Methods (18)
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Documentation missing
Append more data to the stream
Inform that no more content will be appended to the stream,