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

Keywords sent over eventbus and sockjs bridge lose namespace #124

Closed
Jared314 opened this issue Sep 10, 2014 · 7 comments
Closed

Keywords sent over eventbus and sockjs bridge lose namespace #124

Jared314 opened this issue Sep 10, 2014 · 7 comments
Milestone

Comments

@Jared314
Copy link

My server process responds to an event on the Vert.x eventbus, sent using js client library and sockjs bridge, with a hash-map whose keys are namespaced keywords.

{ :workorder/company "Company Name 1" }

When I access the results, in the reply function on the js client, the keywords arrive with the namespace set to null.

cljs.core.Keyword {ns: null, name: "company", fqn: "company", _hash: null, …}

The namespace is also lost on keywords sent from the js client.

@tobias
Copy link
Contributor

tobias commented Sep 10, 2014

We lose the namespace for symbols when we encode to json for the eventbus. If you need a higher-fidelity format, I recommend encoding the data as edn or transit to a string before sending it, then decoding it on the other side. I don't think it would be difficult to write a few wrapper functions to handle that for you. Will that solve your use-case?

@Jared314
Copy link
Author

Encoding it manually will work as a short-term workaround.

I can understand stripping symbol namespaces, but a keyword namespace, because of its use in preventing key collisions, feels like something that should be preserved.

@tobias
Copy link
Contributor

tobias commented Sep 11, 2014

I took a closer look at this, and I think you're right - we should write namespaced keywords out to json as "workorder/company". The keyword function in older versions of cljs wouldn't restore the namespace, but it looks like recent cljs versions do (or at least the latest (0.0-2322) does). I'll try to get this implemented in the next couple of days and get a release out.

@tobias tobias reopened this Sep 11, 2014
@tobias
Copy link
Contributor

tobias commented Sep 11, 2014

Implemented in 96eaa98. I've released 1.0.4-SNAPSHOT - can you give that a try and see if it works for you? You'll need to update conf/langs.properties in your vert.x install, but won't need to recompile your clojurescript.

@Jared314
Copy link
Author

That fixed it for me. Thank you.

@tobias
Copy link
Contributor

tobias commented Sep 18, 2014

Great, thanks for the feedback. I'll try to get a release out early next week.

@tobias tobias modified the milestone: 1.0.4 Sep 18, 2014
@tobias
Copy link
Contributor

tobias commented Sep 23, 2014

This was released as part of 1.0.4.

@tobias tobias closed this as completed Sep 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants