Files
php-react-protocol/doc/text-protos.md

35 lines
775 B
Markdown
Raw Permalink Normal View History

2026-04-02 22:29:35 +02:00
# Text/Line Protocols
## Available sub-protocols
### HttpLikeProtocol
This is as the name says a HTTP-like parser. It can be used for HTTP, STOMP
and more. All messages are expected to follow the following style:
```text
query-line <$lineSeparator>
header-line* <$lineSeparator>
<$lineSeparator>
optional-body
```
Line separators default to `\n`, but can be set to any sequence or the value `true`
to attempt to automatically detect the endings used.
The presence of a body is determined by consulting the headers. The `$contentLengthHeader`
constructor parameter defaults to 'content-length', and can be set to null to disable parsing
of bodies entirely.
```php
$proto = new HttpLikeProtocol(
queryFormat: '{command} {path}',
lineSeparator: true,
)
```