Closed Jared314 closed 10 years ago
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?
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.
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.
Implemented in https://github.com/vert-x/mod-lang-clojure/commit/96eaa9884402981438d0fc4af7031865600413b5. 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.
That fixed it for me. Thank you.
Great, thanks for the feedback. I'll try to get a release out early next week.
This was released as part of 1.0.4.
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.
When I access the results, in the reply function on the js client, the keywords arrive with the namespace set to
null
.The namespace is also lost on keywords sent from the js client.