--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
I've found that it's best / you need to put a newline between messages
so that the response will be properly flushed.
I'm pretty sure I don't need the future, but here's how I've done it.
https://github.com/duck1123/jiksnu/blob/8d66c34f1be8b0b29b0959a18cfdc315346c2bd2/src/jiksnu/actions/stream_actions.clj#L128
Hope that helps.
A result-channel represents a single potential value, as opposed to a
normal channel which represents a stream of values.
The way it works is that the result channel waits for only a single
value and then closes. If the connection is closed (you close/reload
the tab) then that result channel is also closed. This is why you're
only getting that first response.
If you want to stream responses, you have to return something that
will keep the connection open. This can be a normal lamina channel,
but I think you also have input streams, lazy sequences and functions
available. Of course, I've only really tested with returning a
channel, so I can't confirm the rest.
If you want a persistent 2-way connection, look into websockets.
You'll end up doing something rather similar with the server-side
code, but the clojurescript side can be kinda tricky as the default
Closure library didn't include Websocket support. (I believe it's
easier to get a later version in more recent releases.)
So to wrap up, the channel you get from the handler accepts only a
single message. If you want to return multiple messages, enqueue a
response map with a new channel as the :body and siphon into that
channel.
1: https://github.com/ztellman/lamina/wiki/Result-Channels
On Thu, May 3, 2012 at 2:15 AM, Dusan Miloradovic
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to