This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-04
Channels
- # adventofcode (171)
- # beginners (160)
- # boot (13)
- # chestnut (2)
- # cider (6)
- # cljs-dev (15)
- # cljsjs (35)
- # cljsrn (1)
- # clojure (139)
- # clojure-argentina (3)
- # clojure-brasil (1)
- # clojure-greece (31)
- # clojure-italy (5)
- # clojure-russia (5)
- # clojure-spec (18)
- # clojure-uk (11)
- # clojurescript (42)
- # clojurex (6)
- # core-async (12)
- # cursive (14)
- # dirac (13)
- # emacs (13)
- # events (1)
- # fulcro (46)
- # graphql (7)
- # leiningen (10)
- # lumo (3)
- # mount (31)
- # off-topic (20)
- # onyx (30)
- # perun (4)
- # planck (47)
- # re-frame (28)
- # reagent (14)
- # ring (5)
- # shadow-cljs (3)
- # spacemacs (7)
- # specter (13)
- # timbre (3)
- # unrepl (65)
- # yada (8)
I’m stuck on what appears to be a simple question around core.async, maybe someone here can help out:
I want to asynchronously read and handle incoming data in a web-application via a streaming http request
I can convert the incoming body to a channel via lazy-seq like this: (async/to-chan (line-seq (reader body)))
@bhurlow InputStreams have a blocking API so you will need to use a thread - depending on your webserver you may be able to get it to give you some async friendly structure though - core.async channel, manifold promise etc
@mccraigmccraig ok thanks, am using aleph
so seems like manifold stream might be possible
@bhurlow i'm using aleph with #yada - async is with manifold deferreds, which compose nicely with manifold.deferred/chain
or cats.core/mlet
@mccraigmccraig what about for when the incoming body stream is continuous? In my case I can’t necessarily deref the body as it’s not completed until the connection is closed
yada has some nice support for streaming mime-multipart uploads - it does all the separator and part recognition and hands your callback fragments... not sure if there is a manifold-stream interface to it now (this should probably move to #yada 🙂 )