This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-17
Channels
- # announcements (8)
- # atom-editor (8)
- # aws (1)
- # babashka (96)
- # beginners (128)
- # calva (7)
- # cider (12)
- # cljsrn (1)
- # clojure (75)
- # clojure-europe (28)
- # clojure-hamburg (2)
- # clojure-italy (7)
- # clojure-nl (7)
- # clojure-norway (3)
- # clojure-uk (13)
- # clojurescript (26)
- # conjure (2)
- # cursive (18)
- # data-science (7)
- # datalog (21)
- # datomic (9)
- # duct (15)
- # expound (29)
- # figwheel-main (14)
- # fulcro (59)
- # helix (4)
- # jobs (2)
- # kaocha (19)
- # leiningen (15)
- # luminus (4)
- # malli (57)
- # meander (2)
- # off-topic (2)
- # pathom (12)
- # pedestal (8)
- # re-frame (53)
- # reitit (9)
- # remote-jobs (1)
- # shadow-cljs (64)
- # spacemacs (1)
- # specter (2)
- # tools-deps (12)
- # tree-sitter (2)
- # vim (11)
- # xtdb (17)
pathom-viz ws seems to be working:
yenda@desktop:~$ wscat --connect
Connected (press CTRL+C to quit)
there is an expected error in the server since I just connect with no params:
WARN [com.wsscode.node-ws-server:60] - Unhandled request: %s /.websocket
ERROR [taoensso.sente:628] - Client's Ring request doesn't have a client id. Does your server have the necessary keyword Ring middleware (`wrap-params` & `wrap-keyword-params`)?: {:websocket? true, :websocket #object[WebSocket [object Object]], :response nil, :body #object[IncomingMessage [object Object]], :query-params {}, :form-params {}, :params {}}
I tried the simplest possible connection on cljs side with:
(let [{:keys [chsk ch-recv send-fn state] :as res}
(sente/make-channel-socket-client!
"/chsk" ; Note the same path as before
"not needed"
{:host "localhost" :port 8240 :type :auto ; e/o #{:auto :ajax :ws}
})]
(println :res res)
(def chsk chsk)
(def ch-chsk ch-recv) ; ChannelSocket's receive channel
(def chsk-send! send-fn) ; ChannelSocket's send API fn
(def chsk-state state) ; Watchable, read-only atom
)
(let [;; Not available with React Native, etc.:
win-loc (enc/get-win-loc)
path (or path (:pathname win-loc))]
(if-let [f (:chsk-url-fn opts)] ; Deprecated
[(f path win-loc :ws)
(f path win-loc :ajax)]
(let [protocol (or protocol (:protocol win-loc) :http)
host (if port
(str (:hostname win-loc) ":" port)
(do (:host win-loc)))]
[(get-chsk-url protocol host path :ws)
(get-chsk-url protocol host path :ajax)])))
unless I'm misunderstanding it looks like sente ignores the host and uses win-loc instead?
Looks like there is a bug in sente that is fixed in the next version, so I tried the newer version but it still doesn't connect
done, also fixed the example to use cond->>
, thanks for pointing those out