Unfortunately Chord only accepts raw strings on the channel at the moment - I've been using pr-str and read-string around EDN messages until now.
It's a great idea to be able to format/parse different message formats automatically though and something that IMO Chord should provide. I've added a GitHub issue <https://github.com/james-henderson/chord/issues/4> - watch this space! Thanks, James On Monday, 2 December 2013 09:38:50 UTC, Henrik Eneroth wrote: > > Cool! I presume you're restricted to EDN on the channels though, right? > > On Saturday, November 30, 2013 5:23:17 PM UTC+1, James Henderson wrote: >> >> https://github.com/james-henderson/chord >> >> Chord is a library for making WebSockets look like simple core.async >> channels in Clojure (using http-kit) and ClojureScript. >> >> Basic usage: >> >> Leiningen: >> >> [jarohen/chord "0.2.1"] >> >> ClojureScript: >> >> (:require [chord.client :refer [ws-ch]] >> [cljs.core.async :refer [<! >! put! close!]])(:require-macros >> [cljs.core.async.macros :refer [go]]) >> (go >> (let [ws (<! (ws-ch "ws://localhost:3000/ws"))] >> (>! ws "Hello server!") >> (loop [] >> (when-let [{:keys [message]} (<! ws)] >> (js/console.log "Got message from server:" message) >> (recur))))) >> >> >> Clojure (a wrapper around http-kit's 'with-channel'): >> >> (:require [chord.http-kit :refer [with-channel]] >> [clojure.core.async :refer [<! >! put! close! go]]) >> (defn your-handler [req] >> (with-channel req ws-ch >> (go >> (let [{:keys [message]} (<! ws-ch)] >> (println "Message received from client:" message) >> (>! ws-ch "Hello client from server!") >> (close! ws-ch))))) >> >> >> There's more documentation and a few code examples on the Github page, >> and a full example project in the repo. >> >> Feedback is *always very welcome* - either here, through Github in the >> usual way or (if it fits into 140 chars!) Twitter. >> >> Version 0.2.1 brings the ability to specify custom buffered channels - >> thanks to Timo Sulg for the PR! >> >> James (@jarohen) >> > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.