StompFrame.prototype.send = function(stream) {
// Avoid small writes, they get sent in their own tcp packet, which
// is not efficient (and v8 does fast string concat).
var frame = this.command + '\n';
for (var key in this.headers) {
frame += key + ':' + this.headers[key] + '\n';
}
if (this.body.length > 0) {
frame += 'content-length:' + Buffer.byteLength(this.body) + '\n';
}
frame += '\n';
if (this.body.length > 0) {
frame += this.body;
}
frame += '\0';
stream.write(frame);
};
As the source code of StompFrame.send show above, every property in variable 'headers' will be sent, including functions. In my project I had extended some functions of Object's prototype already, this function will send function content as StompFrame's header to the Queue, and the subscriber got the unexpected message, maybe it is an error of header parser.
So that, could you add an filter to the header properties, assert the value to the property is not a function is nice, and consider that the header value contains '\n'?
StompFrame.prototype.send = function(stream) { // Avoid small writes, they get sent in their own tcp packet, which // is not efficient (and v8 does fast string concat). var frame = this.command + '\n'; for (var key in this.headers) { frame += key + ':' + this.headers[key] + '\n'; } if (this.body.length > 0) { frame += 'content-length:' + Buffer.byteLength(this.body) + '\n'; } frame += '\n'; if (this.body.length > 0) { frame += this.body; } frame += '\0'; stream.write(frame); };
As the source code of StompFrame.send show above, every property in variable 'headers' will be sent, including functions. In my project I had extended some functions of Object's prototype already, this function will send function content as StompFrame's header to the Queue, and the subscriber got the unexpected message, maybe it is an error of header parser. So that, could you add an filter to the header properties, assert the value to the property is not a function is nice, and consider that the header value contains '\n'?