没有 headers 的 stomp frame 会是什么样子?
What would a stomp frame with no headers look like?
我正在编写一个 stomp 框架 decoder/encoder,并且在编写单元测试时,我想知道没有 headers 的 stomp 框架会是什么样子?
我猜,在 C++ 中,它会是这样的:
std::string frameDataAsString =
"SEND\n"
"\n"
"This is a test message";
对吗?
你的框架看起来很接近。我相信它需要以 NULL 八位字节结尾(例如 [=11=]
或 \u0000
),如 STOMP 1.2 specification:
中所述
... A frame's structure looks like:
COMMAND
header1:value1
header2:value2
Body^@
The frame starts with a command string terminated by an end-of-line (EOL), which consists of an OPTIONAL carriage return (octet 13) followed by a REQUIRED line feed (octet 10). Following the command are zero or more header entries in <key>:<value>
format. Each header entry is terminated by an EOL. A blank line (i.e. an extra EOL) indicates the end of the headers and the beginning of the body. The body is then followed by the NULL octet. The examples in this document will use ^@
, control-@
in ASCII, to represent the NULL octet. The NULL octet can be optionally followed by multiple EOLs.
我正在编写一个 stomp 框架 decoder/encoder,并且在编写单元测试时,我想知道没有 headers 的 stomp 框架会是什么样子?
我猜,在 C++ 中,它会是这样的:
std::string frameDataAsString =
"SEND\n"
"\n"
"This is a test message";
对吗?
你的框架看起来很接近。我相信它需要以 NULL 八位字节结尾(例如 [=11=]
或 \u0000
),如 STOMP 1.2 specification:
... A frame's structure looks like:
COMMAND header1:value1 header2:value2 Body^@
The frame starts with a command string terminated by an end-of-line (EOL), which consists of an OPTIONAL carriage return (octet 13) followed by a REQUIRED line feed (octet 10). Following the command are zero or more header entries in
<key>:<value>
format. Each header entry is terminated by an EOL. A blank line (i.e. an extra EOL) indicates the end of the headers and the beginning of the body. The body is then followed by the NULL octet. The examples in this document will use^@
,control-@
in ASCII, to represent the NULL octet. The NULL octet can be optionally followed by multiple EOLs.