Fork me on GitHub

ive got kind of an obscure question 🙂 I have 2 apps, both with jetty/ring-adapter 1.8.1, muuntaja 0.6.7 for transit. I’d like to stream it all the way to the browser. the browser calls app A, which calls app B using clj-http 3.10.1 and with the following options

(defn as-stream [params]
  (-> params
      (assoc :as :stream :decompress-body false)
      (update :headers assoc :accept-encoding "gzip")))
to avoid unziping and rezipping the response. App B pulls a large dataset from the db. I just enabled streaming in muuntaja with :return :output-stream When i call app B directly via curl, i get the response within a reasonable time. When i call app A, the streaming happens very very slowly, with multi second pauses. Does this ring any bells for anyone?


cc @U055NJ5CC because muuntaja is involved


google has led me to which seems potentially relevant except that i just want to proxy the response, not the request


Not sure how transit & clj-http play together when streaming. The :as :stream might be blocking operation as I think is the transit write (but, with different streams). Might also be a bug in muuntaja-streamong-transit. If there is a jsva-side reverse proxy code available, I would anyway go with that.


for async clj-proxy, I believe you need: - run server in (ring-)async-mode - use the async mode in clj-http - stream out asynchronously: ring1 only defines blocking writes, but usually this is not a problem. You could bypass ring here and write lazily to the underlaying java web servers channel etc.


@U0BKWMG5B is the best person to help I guess