Skip to content
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

Closed
cinterloper opened this issue Dec 27, 2015 · 6 comments

Comments

@cinterloper
Copy link

(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

@cinterloper
Copy link
Author

Hey guys, i have updated the repo above
unless im doing something wrong, this also appears to be broken in Groovy - is there a unit test for headers?

@cinterloper cinterloper changed the title Adding headers to bridge events does not work (in javascript on 3.2) Adding headers to bridge events does not work (in javascript and in groovy on 3.2) Jan 4, 2016
@cescoffier
Copy link
Member

What do you mean by "broken in groovy" ? Do you have header working in a JS verticle and not in a Groovy verticle ?

@cinterloper
Copy link
Author

I have updated the readme here:
https://github.com/cinterloper/vertx-tinkering

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

@vietj
Copy link

vietj commented Jan 13, 2016

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.

@purplefox
Copy link
Contributor

This is the case in the JS API, although in the Java API a reference to the uncopied object is returned.

@cescoffier
Copy link
Member

Fixed in the related project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants