Search code examples
stomp

What would a stomp frame with no headers look like?


I am writing a stomp frame decoder/encoder, and as I am writing unit tests, I am wondering, what would a stomp frame with no headers looks like?

I am guess, in C++, it would be something like:

std::string frameDataAsString =
    "SEND\n"
    "\n"
    "This is a test message";

Is that correct?


Solution

  • Your frame looks close. I believe it needs to end with the NULL octet (e.g. \0 or \u0000) as described in the 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.