New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding headers to bridge events does not work (in javascript and in groovy on 3.2) #77
Comments
Hey guys, i have updated the repo above |
What do you mean by "broken in groovy" ? Do you have header working in a JS verticle and not in a Groovy verticle ? |
I have updated the readme here: what I mean is, as far as i can tell, following the instructions on vertx.io, adding headers at the bridge does not work in either JavaScript or Groovy |
it is due to the fact that rawMessage() makes a copy of the original JsonObject. To solve it we need to have a setRawMessage(JsonObject) and add in the doc that a modified message should be set. |
This is the case in the JS API, although in the Java API a reference to the uncopied object is returned. |
Fixed in the related project. |
(moved from vert-x3/lang-js)
here is my example repo:
https://github.com/cinterloper/vertx-tinkering
according to this documentation:
http://vertx.io/docs/vertx-web/js/#_sockjs_event_bus_bridge
i should be able to add 'headers' (username, etc) to a message coming across the sockjs bridge
sockJSHandler.bridge(options, function (be) {
if (be.type() === 'PUBLISH' || be.type() === 'SEND') {
// Add some headers
var headers = {
"header1" : "val",
"header2" : "val2"
};
be.rawMessage().headers = headers;
}
be.complete(true);
}
however, when receiving the message (in the same vertical or in other verticals) i am unable to retrieve the headers
The text was updated successfully, but these errors were encountered: