Closed Toparvion closed 6 years ago
Indeed it needs to be implemented. Give me few days while I figure out the best way to do it.
I will first release it is a branch so that you can also test before I push it as a general release.
Ok, @kum-deepak, thanks! I'm looking forward to become the first user (and tester) of this feature :blush:
Meanwhile, I've temporarily solved the problem by adding a naive function to the Frame
object:
Frame.unescape = function (value) {
return value
.replace(new RegExp("\\r", 'g'), '\r')
.replace(new RegExp("\\c", 'g'), ':')
.replace(new RegExp("\\n", 'g'), '\n')
.replace(new RegExp("\\\\", 'g'), '\\')
};
and calling it in appropriate command handlers like:
case "MESSAGE":
subscription = Frame.unescape(frame.headers.subscription);
onreceive = _this.subscriptions[subscription] || _this.onreceive; // this is where the error stepped in
Please check branch header_escape
. Test it out, if possible check the code diff as well.
@kum-deepak, answered in PR #17.
Will close after release of a new version.
Released new version 3.1.2.
@kum-deepak, can you please deploy this version as webjar?
Deployed. In future you can do it yourself. It does not ask for any authentication - when picking from npm.
Hello, I've started to use your branch of JS stomp-websocket library (thanks for the great job, BTW) and found out that there is a certain discrepancy with protocol spec. Namely, STOMP 1.2 specification states that almost all frames must not only be encoded to UTF-8 but also must be escaped:
In my project I send messages that have colon in their
destination
header. The colon comes from server to client in the form of\c
symbols that is totally right according to STOMP 1.2 spec:But the client does not convert it back to colon and thus misses the messages with the following record in log:
Can you please enhance the library with (un)escaping capability?