Discussion:
SSE and Manifold Stream
bplatz
2016-03-10 22:08:20 UTC
Permalink
I wanted to confirm the SEE behavior I'm seeing is correct.

Upon severing an SSE connection (i.e. closing browser, reloading) both
@(s/put! ...) and @(s/try-put! ...) will return true for the very next put
to the channel, and the stream remains open.

The second put! will close the connection (on-closed is called, also
s/closed? and s/drained? are true).

I was assuming the first put! after the connection is severed would fail,
not the second.

I just want to ensure I have the correct behavior, and I didn't set
something up incorrectly.

Thanks!

-Brian
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Zach Tellman
2016-03-11 19:07:39 UTC
Permalink
Hi Brian,

To confirm, you're returning a response map where the body is a stream, and
putting directly into that stream?

Zach
Post by bplatz
I wanted to confirm the SEE behavior I'm seeing is correct.
Upon severing an SSE connection (i.e. closing browser, reloading) both
@(s/put! ...) and @(s/try-put! ...) will return true for the very next put
to the channel, and the stream remains open.
The second put! will close the connection (on-closed is called, also
s/closed? and s/drained? are true).
I was assuming the first put! after the connection is severed would fail,
not the second.
I just want to ensure I have the correct behavior, and I didn't set
something up incorrectly.
Thanks!
-Brian
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
bplatz
2016-03-11 20:22:31 UTC
Permalink
Zack,

That is correct, an(s/stream) is passed directly to the :body.

First put after connection is severed returns true, not really surprising.

Second put also returns true, but seems to trigger on-closed.

Third put returns false.

Thanks for the response!

-Brian
Post by Zach Tellman
Hi Brian,
To confirm, you're returning a response map where the body is a stream,
and putting directly into that stream?
Zach
Post by bplatz
I wanted to confirm the SEE behavior I'm seeing is correct.
Upon severing an SSE connection (i.e. closing browser, reloading) both
@(s/put! ...) and @(s/try-put! ...) will return true for the very next put
to the channel, and the stream remains open.
The second put! will close the connection (on-closed is called, also
s/closed? and s/drained? are true).
I was assuming the first put! after the connection is severed would fail,
not the second.
I just want to ensure I have the correct behavior, and I didn't set
something up incorrectly.
Thanks!
-Brian
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
ztellman
2016-03-28 17:20:05 UTC
Permalink
Sorry for the slow response on this. Propagation of closing in Manifold
requires trying to `put!` a message, so each stream transformation adds a
message's worth of lag between the downstream connection closing and that
being reflected by the return value from `put!`. This is usually harmless,
but I can see how this would be confusing in this specific case. The
latest release of Aleph (0.4.1-beta7) will immediately close the response's
body when the connection closes.

Thanks for the report,
Zach
Post by bplatz
Zack,
That is correct, an(s/stream) is passed directly to the :body.
First put after connection is severed returns true, not really surprising.
Second put also returns true, but seems to trigger on-closed.
Third put returns false.
Thanks for the response!
-Brian
Post by Zach Tellman
Hi Brian,
To confirm, you're returning a response map where the body is a stream,
and putting directly into that stream?
Zach
Post by bplatz
I wanted to confirm the SEE behavior I'm seeing is correct.
Upon severing an SSE connection (i.e. closing browser, reloading) both
@(s/put! ...) and @(s/try-put! ...) will return true for the very next put
to the channel, and the stream remains open.
The second put! will close the connection (on-closed is called, also
s/closed? and s/drained? are true).
I was assuming the first put! after the connection is severed would
fail, not the second.
I just want to ensure I have the correct behavior, and I didn't set
something up incorrectly.
Thanks!
-Brian
--
You received this message because you are subscribed to the Google
Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Aleph" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aleph-lib+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...