Files
php-react-protocol/doc/text-protos.md
Christopher Vagnetoft 62a1167055 Initial commit
2026-04-02 22:29:35 +02:00

775 B

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:

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.

$proto = new HttpLikeProtocol(
    queryFormat: '{command} {path}',
    lineSeparator: true, 
)