Fork me on GitHub
#aleph
<
2016-05-02
>
keeth17:05:37

interesting behavior of manifold.stream/consume - it ignores buffers, so if your consumer function is slower than the producer the producer will block as if the stream was unbuffered, e.g.

(def stream (s/stream 5))

(future 
  (s/consume 
    (fn [x] 
      (println x) 
      (Thread/sleep 1000)) 
    stream))

(future
  (doseq [n (range 10)] 
    @(s/put! stream n)
    (println "put" n)))

keeth17:05:30

gives

1
put 1
2
put 2
etc

keeth17:05:49

if you swap the consume call with a loop that takes from the stream, the first 5 put!s succeed immediately, filling the buffer, as you would expect.

shaunxcode21:05:20

has anyone managed to get aleph websocket server to aggregate fragmented frames?

shaunxcode22:05:37

so my fix is one line but would probably be something you want to pass in as a config param

shaunxcode22:05:21

in the initialize-websocket-handler when you setup the pipeline right before adding the "websocket-handler" we need to add the "websocket-frame-aggregator"

shaunxcode22:05:26

(.addLast pipeline "websocket-frame-aggregator" (WebSocketFrameAggregator. (* 16 1024 1024)))

shaunxcode22:05:48

(that large number is what would be passed in as a config param I assume)

shaunxcode22:05:01

anyway this totally worked and I can now paste giant images over aleph sockets

shaunxcode22:05:31

@ztellman: forgot to tag you in the above