aleph

igrishaev 2018-12-03T15:11:15.014200Z

Hi, just a small question. While reading aleph Websockets samples, I found this:

;; take all messages from the client, prepend the name, and publish it to the room
        (s/consume
          #(bus/publish! chatrooms room %)
          (->> conn
            (s/map #(str name ": " %))
            (s/buffer 100)))
What’s the meaning here of wrapping the source stream with a buffer? As far as I understand, it’s important when sending messages into a stream. But what does buffering when reading messages?

igrishaev 2018-12-03T15:11:51.014600Z

And what will happen if I drop the trailing (s/buffer 100)?

rborer 2018-12-03T15:31:34.015400Z

I believe that without the buffer sending a message from a client would "block" until all participants have received it

rborer 2018-12-03T15:31:49.015700Z

Per https://github.com/ztellman/manifold/blob/master/docs/stream.md#buffers-and-backpressure > We saw above that if we attempt to put a message into a stream, it won't succeed until the value is taken out. This is because the default stream has no buffer

rborer 2018-12-03T15:35:43.016100Z

Well no, it depends on the implementation of event-bus

igrishaev 2018-12-03T15:36:30.017Z

Well, I got it as pre-loading a certain amount of messages in advance

igrishaev 2018-12-03T15:36:57.017500Z

Like the do when reading a file from a disk.

rborer 2018-12-03T15:37:15.018Z

yeah, but then the example wouldn't work, right? I mean, the example is sending a single message by each client 😕

igrishaev 2018-12-03T15:38:34.019Z

It would. There is a video when the author says, without a buffer a slow client may slow down everybody

pithyless 2018-12-03T17:02:33.020100Z

@igrishaev - this is where ztellman talks about buffering and throttling chats: https://www.youtube.com/watch?v=1bNOO3xxMc0&t=1887