Closed dchacke closed 4 years ago
Hey, I also seem not to be able to provide a custom :host
. My clojure-foo is not advanced but I am trying to dig into the code, maybe I'll find an answer there and share.
I am also trying to figure out how to use another host.
Looking at make-channel-socket-client!
it seems to be using encore/get-win-loc
and shadowing protocol
and host
if :chsk-url-fn
is not provided. Given that usage is deprecated, it is not desirable to specific a custom host?
I am developing the client portion locally and would like to connect to a development server in the cloud, where DB access is faster.
I was able to workaround this for now by using this hack:
(defn chsk-url-fn [_ _ type*]
(cond
(and DEBUG (= type* :ws)) "wss://example.com/api/example/dev/chsk"
(and DEBUG (= type* :ajax)) "https://example.com/api/example/dev/chsk"
(and DEVELOPMENT (= type* :ws)) "wss://example.com/api/example/dev/chsk"
(and DEVELOPMENT (= type* :ajax)) "https://example.com/api/example/dev/chsk"
:else nil))
(defn start! []
(let [opts {:type :ws
:chsk-url-fn chsk-url-fn}
{:keys [chsk ch-recv send-fn state]}
(sente/make-channel-socket! nil nil opts)]
(comment "your code here")))
I have the same issue. It seems weird that manual overrides are being ignored. I used raymond-w-ko's hack
Closing for now since this seems to be related to #353 (?), which will be addressed in a moment. Please feel free to re-open if this is unrelated.
Apologies for the delay!
Clojure noob here, but it looks like the channel socket option :port is ignored unless a CSRF token is provided. But that's not clear from the README, where you seem to omit the CSRF token. From https://raw.githubusercontent.com/ptaoussanis/sente/7d8ca800d950026a3171bdd0e438395766b8251a/README.md:
Note that you pass the path, but no CSRF token.
I also can't seem to set a custom :host even when I provide a CSRF token.
My code is:
It connects to localhost:8080 instead of foo:8080.
Am I doing something wrong, or is this an issue with the code base?
PS when protocol "http" is provided, it throws an exception saying that "http:" (with a colon) should be provided:
Is this stuff documented somewhere?
I'm on version 1.15.0.