Add to project:
:dependencies [;...
[reframe-websocket "0.0.1"]]
(ns ...
(:require [reframe-websocket.core :as reframe-websocket]))
This will create an event handler called :get
and a subscription
handler called :set
to be used like:
(reframe/dispatch-sync [:set [:some :path] "abc123"])
;; sets the path [:some :path] to value "abc123" in the app-db
@(reframe/subscribe [:get [:some :path]])
;; => "abc123"
(def my-aws (reframe-websocket/async-websocket "ws://localhost:7890"))
(send-msg "your message" my-aws) ; Send a message
;; define a function that will store the response from the server
(defn storage-fn [msg]
(reframe-dispatch-sync [:set [:some :other :path] msg]))
;; Get the message from the server storing it with your storage function
(read-msg storage-fn my-aws)
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close