StreamProtocol
abstract class StreamProtocol
Properties
| protected bool | $started | ||
| protected bool | $errored | ||
| protected Throwable|null | $exception |
Methods
Get the protocol parts that represent the given response's events.
Get the protocol parts that terminate a stream interrupted by an exception.
Get the response headers for the protocol.
Create an HTTP response that represents the given response using the protocol.
Get the raw frame that terminates the stream, if any.
Encode the given protocol part as a server-sent event line.
Encode the given value as JSON, substituting bytes a provider streamed as invalid UTF-8.
Details
at line 26
abstract protected Generator
parts(StreamableAgentResponse $response)
Get the protocol parts that represent the given response's events.
at line 31
abstract protected Generator
maskedErrorParts()
Get the protocol parts that terminate a stream interrupted by an exception.
at line 38
protected array
headers()
Get the response headers for the protocol.
at line 49
Response
response(StreamableAgentResponse $response)
Create an HTTP response that represents the given response using the protocol.
at line 88
protected string|null
terminator()
Get the raw frame that terminates the stream, if any.
at line 98
protected string
encode(array $part)
Encode the given protocol part as a server-sent event line.
at line 106
protected string
json(mixed $value)
Encode the given value as JSON, substituting bytes a provider streamed as invalid UTF-8.