class Emitter implements EmitterInterface

Sends a response, streaming it only where streaming is what was asked for.

Nearly everything Flarum returns is a complete string that should be sent in one go, which is what {\Laminas\HttpHandlerRunner\Emitter\SapiEmitter} does. A handful of things — clearing the cache, which recompiles every asset and can run for half a minute — need to reach the browser as they happen, and for those the body is a {\Laminas\Diactoros\CallbackStream} whose callback writes and flushes progressively. The distinction is drawn on the body rather than a flag, because `SapiEmitter` would defeat a callback body anyway: it casts the stream to a string, which runs the callback to completion before a single byte is sent.

Methods

__construct(EmitterInterface $buffered = new SapiEmitter(), EmitterInterface $streamed = new SapiStreamEmitter())

No description

bool
emit(ResponseInterface $response)

No description

Details

__construct(EmitterInterface $buffered = new SapiEmitter(), EmitterInterface $streamed = new SapiStreamEmitter())

Parameters

EmitterInterface $buffered
EmitterInterface $streamed

bool emit(ResponseInterface $response)

Parameters

ResponseInterface $response

Return Value

bool