HttpTransport
class HttpTransport implements Transport, StreamsMessages
Properties
| protected bool | $streaming | ||
| protected null|list<string> | $messages |
Methods
Create an HTTP transport for one request.
Send an encoded protocol message.
Dispatch the request and transfer stream ownership to its response.
Determine the status of a non-streaming response.
Stream messages with the negotiated protocol's disconnect behavior.
Yield messages after each producer advancement without retaining its callback.
Frame direct generator output without bypassing the message hook.
Drain messages before advancing the producer again.
Write one event to a callback-based stream.
Return the response headers for the current delivery mode.
Details
at line 30
__construct(Request $request, Closure|null $handler = null, string|null $reply = null, Closure|null $stream = null)
Create an HTTP transport for one request.
at line 41
void
onReceive(Closure $handler)
Register the incoming message handler.
at line 49
void
send(string $message)
Send an encoded protocol message.
at line 63
run()
Dispatch the request and transfer stream ownership to its response.
at line 113
protected int
statusCode()
Determine the status of a non-streaming response.
at line 140
void
stream(Closure $stream)
Register a streaming callback.
The callback may echo SSE-formatted output directly or return an iterable of message payloads.
at line 150
void
streamMessages(Closure $producer, bool $cancelOnDisconnect)
Stream messages with the negotiated protocol's disconnect behavior.
at line 173
protected Generator
messageStream(Closure $producer)
Yield messages after each producer advancement without retaining its callback.
at line 196
protected Generator
streamPayloads(iterable $messages)
Frame direct generator output without bypassing the message hook.
at line 212
protected Generator
drainMessages()
Drain messages before advancing the producer again.
at line 247
protected void
sendStreamMessage(string $message)
Write one event to a callback-based stream.
at line 263
protected array
getHeaders()
Return the response headers for the current delivery mode.