Fork me on GitHub
#yada
<
2017-06-15
>
bradford03:06:26

Are there any common reasons why I could manifold/put! something onto an SSE stream, but the client won't acknowledge it for 40+ seconds? This happens even if I have a large buffer and put 1 or 2 objects in

bradford03:06:23

When opening the connection, here's what runs:

(defn yada-sse [ctx]
  (let [{:keys [request response-channel]} ctx
        addr (or (get (:headers request) "x-forwarded-for") (:remote-addr request))
        country (get (Util/getGeo addr) "country_code")
        source (ms/periodically 5000 (fn [] " "))
        sink (ms/stream 1000)]
    (ms/on-closed sink
                  #(close-conn ctx))
    (update-proxy-pool addr sink country)
    (info "Connecting...")
    (ms/put! sink (str "data: " (generate-string {:ip @afghan.util/this-ip})))
    (ms/connect source sink)
    sink))
(yes, I had to do some odd things to be compatible with this client)

bradford03:06:07

Where is the Yada code that reads from a manifold stream and sends it to the SSE client?

malcolmsparks07:06:55

@bradford do you have anything like nginx in between? If so, you need some configuration to avoid buffering

malcolmsparks07:06:17

There is no code in yada that reads from the manifold stream. That's kind of the point of using manifold. Aleph passes the stream to Netty.

malcolmsparks07:06:36

The actual code is in Netty.

bradford16:06:31

@malcolmsparks nope, no nginx 🙂