-
Notifications
You must be signed in to change notification settings - Fork 40
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
JSON format support #8
Conversation
…ly need to CLJX this...
Thanks Michael :) I've moved your snippet into chord.http-kit - unless Chord goes down the route of making JSON support optional (which I'm quite open to - discussion in #9) I think it'd be easier for users to just have one NS to require. I've also mirrored the feature in the CLJS version (I really should get around to migrating Chord to CLJX!), updated a few docstrings and cut a 0.3.1-rc1 release - could you let me know whether this works for your use case? If so, I'll cut a stable version tomorrow. Thanks again, James |
I get
with the following CLJS code with 0.3.1-rc1: (ns azondi.events
(:require [chord.client :refer [ws-ch]]
[cljs.core.async :refer [<! >! put! close! timeout]]
[cljs.reader :as edn])
(:require-macros [cljs.core.async.macros :refer [go]]))
(set! (.-onload js/window)
(fn []
(go
(let [ws (<! (ws-ch "ws://127.0.0.1:8083/events/stream"))]
)))) and the line seems to be cljs.core._add_method.call(null, chord.http_kit.wrap_format, new cljs.core.Keyword(null, "json", "json", 1017176154), function(p__11553, _) {
var map__11554 = p__11553;
var map__11554__$1 = cljs.core.seq_QMARK_.call(null, map__11554) ? cljs.core.apply.call(null, cljs.core.hash_map, map__11554) : map__11554;
var write_ch = cljs.core.get.call(null, map__11554__$1, new cljs.core.Keyword(null, "write-ch", "write-ch", 3462353029));
var read_ch = cljs.core.get.call(null, map__11554__$1, new cljs.core.Keyword(null, "read-ch", "read-ch", 2094260078));
return new cljs.core.PersistentArrayMap(null, 2, [new cljs.core.Keyword(null, "read-ch", "read-ch", 2094260078), cljs.core.async.map_LT_.call(null, chord.client.try_read_json, read_ch), new cljs.core.Keyword(null, "write-ch", "write-ch", 3462353029), cljs.core.async.map_GT_.call(null, cljs.core.clj__GT_js, write_ch)], null);
}) |
I believe I've corrected the issue. Can you please push rc2? |
Thanks, deployed rc2 |
I'm currently working on updating the example project to test the JSON support but haven't quite managed to make it work yet. Will probably have time over the weekend to finish this off. James |
It seems to be good to go. |
@james-henderson let me know if you want anything else done to this PR. |
Hi Michael, sorry for the delay, have had a hectic week. I've added support for :json-kw as well, to keywordize any map keys passed via JSON, and released 0.3.1. Thanks for your help! James |
As discussed over email.