This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-28
Channels
- # aleph (50)
- # announcements (3)
- # aws (35)
- # beginners (74)
- # boot (25)
- # calva (39)
- # cider (18)
- # clara (2)
- # cljdoc (18)
- # cljs-dev (24)
- # cljsrn (11)
- # clojure (166)
- # clojure-europe (13)
- # clojure-italy (5)
- # clojure-nl (6)
- # clojure-spec (35)
- # clojure-uk (263)
- # clojurescript (22)
- # clojutre (1)
- # code-reviews (34)
- # cursive (58)
- # data-science (2)
- # datascript (4)
- # datomic (4)
- # duct (6)
- # emacs (7)
- # figwheel-main (9)
- # fulcro (2)
- # graphql (3)
- # hoplon (22)
- # hyperfiddle (2)
- # juxt (5)
- # kaocha (6)
- # leiningen (33)
- # luminus (15)
- # off-topic (1)
- # pedestal (5)
- # reagent (18)
- # reitit (12)
- # shadow-cljs (171)
- # vim (5)
Hi! Using websocket-client
to connect into websocket endpoint. This works just fine but I have a problem when target endpoint is not there when trying to make the connection
I think it is because websocket-client
returns a deferred which I must first dereference to use it
And that dereferencing will hang until the connection is established, which it never manages to do since the target endpoint isn't available
Second, there’s a ConnectionTimeout that fires when you cannot establish a TCP connection. The problem with Websocket protocol is that it requires one another round-trip to setup the stream: handshake request/response (see https://github.com/ztellman/aleph/pull/422 and https://github.com/netty/netty/issues/8841). If your server is “not there”, it fails. If your server unable to finish the handshake - it’s not managed by the Aleph for now (it would be after PR is merged tho’).
Well in this case the target server is starting sometimes when I'm trying to establish connection
(-> (websocket-client ...)
(d/timeout! 5e3 ::timeout)
(d/chain' (fn [conn] (if-not (identical? ::timeout conn) conn (time/in 5e3 (websocket-client ...))))))
Hi! There is a lot of middleware for the HTTP client. Yet I don’t understand how to use them when sending HTTP calls. For example, when GET-ting a JSON file, how to finish with the body being parsed automatically? What option should I specify?
yes, it seems to be the full version
(defmethod coerce-form-params :application/json
but it’s not a problem, really. Instead, it would be nice to add more examples in readme because auto encode/decode JSON happens constantly
what is good about clj-http, you never remember all the options, but they’ve got rich base of examples, so you just copy and paste