Binary data is not handled
I'm sending the following bytes from java: 45,-113,4,-120 and on the node.js side I get: 45 65533 4 65533 for (i=0;i<message.body.length;i++) { console.log(message.body.charCodeAt(i)); }
STOMP supports binary data, so I would expect it it be handled with Buffers instead of strings.
I'll take a look at this. You're right though, if it's a bytes message, it should use buffers instead of strings.
Can you please try out branch issue-15 (https://github.com/benjaminws/stomp-js/tree/issue-15). All it does is convert the body of the message back to a buffer if it's detected that the message is a binary message (by the presence of content-length header).
That doesn't help. The bytes are already lost in translation before that.
Doh, you're right. I'll try another approach. This whole codebase needs a major refactoring :(
New approach will leave the buffer intact, only slicing out the command/header bits as needed. Can you pull it down and test it for yourself?
Looked at this again. Problem is more annoying that I initially thought. Working on a fix, though. Should have something cooked up tomorrow.
The body is still not a buffer (it's a Frame) which still mangles up the bytes.
Right. Hence the last note. Will hopefully have a fix today. The problem is the way I'm handling the incoming buffer, trying to treat it as a string initially instead of a buffer. Needs some extra work to parse out what I need from the buffer (no niceties like split, indexOf, etc on a buffer).
Greatly appreciate your work.