The on('data') handler has apparent spec violation and subsequent fix that introduces a regression.
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.
var frames = buffer.split('\0\n');
A fix was added that breaks pipelined frames, if frames arrive with mixed \0 and \0\n
// Temporary fix : NULL,LF is not a guranteed standard, the LF is optional, so lets deal with it. (Rauls)
if (frames.length == 1) { // N.B. == 1means only it the previous split did nothing.
frames = buffer.split('\0');
}
Side note: \0 is valid inside MESSAGE data if content-length was provided. But I guess thats a bigger issue.Its OK thatn stomp.js does not support binary. Should be in the docs tho.
I think just
var frames = buffer.split('\0');
Should suffice, I tested that and it seems OK.
Mixed \0 and \0\n terminations occur when \n heartbeats are added between frames that then get buffered.
The on('data') handler has apparent spec violation and subsequent fix that introduces a regression.
A fix was added that breaks pipelined frames, if frames arrive with mixed \0 and \0\n
Side note: \0 is valid inside MESSAGE data if content-length was provided. But I guess thats a bigger issue.Its OK thatn stomp.js does not support binary. Should be in the docs tho.
I think just
Should suffice, I tested that and it seems OK.
Mixed \0 and \0\n terminations occur when \n heartbeats are added between frames that then get buffered.