This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-20
Channels
- # aleph (11)
- # announcements (3)
- # babashka (35)
- # babashka-sci-dev (28)
- # beginners (29)
- # calva (51)
- # cider (33)
- # clj-kondo (26)
- # clj-on-windows (1)
- # clojure (40)
- # clojure-austin (1)
- # clojure-europe (47)
- # clojure-nl (9)
- # clojure-norway (7)
- # clojure-uk (5)
- # clojurescript (69)
- # conjure (30)
- # cursive (7)
- # data-science (9)
- # datomic (2)
- # etaoin (10)
- # events (2)
- # fulcro (1)
- # graalvm (1)
- # gratitude (6)
- # helix (16)
- # honeysql (20)
- # hyperfiddle (14)
- # inf-clojure (2)
- # jobs (1)
- # jobs-discuss (12)
- # kaocha (9)
- # leiningen (2)
- # lsp (4)
- # malli (8)
- # music (9)
- # off-topic (12)
- # pathom (10)
- # portal (14)
- # practicalli (15)
- # re-frame (27)
- # reitit (7)
- # remote-jobs (4)
- # sci (37)
- # shadow-cljs (16)
- # sql (8)
- # tools-deps (6)
- # vim (6)
- # xtdb (21)
I'm returning a stream as the body of a handler. I'm noticing that streaming the results seems to hang until a certain amount of content is put into the stream
e.g.
(defn handler [req]
(let [stream (s/stream)]
(doseq [i (range 0 100)]
(s/put! stream i))
(d/future
(Thread/sleep 4000)
(s/close! stream))
{:status 200
:headers {"content-type" "text/plain"}
:body stream}))
this will wait until the stream is closed (4 seconds later) to send the content to the client
Hmm, well there are some flush fns in aleph.netty
, but they’re not really designed to be used directly.
I’ll take a closer look at the delay in the next few days, it kind of defeats the point of a streaming server if it can’t, ya know, stream 😄
yeah. if I shove a bunch more data down the pipe (e.g. 1000 numbers) then it will send it to the client quickly, and keep the connection open until the stream closes, which is what I want
> Ok in order for Safari to render the html at least 1024 bytes have to be written before it starts to render as received. 🆒
Ahh, good ol’ SafarIE