diff options
author | Loïc Hoguin <[email protected]> | 2017-06-16 17:46:15 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2017-06-16 17:46:15 +0200 |
commit | 02fa5f3606b5e18fb21fe48afcc73dad71b36ec9 (patch) | |
tree | c85ef9f7c0a0d3c4efab0d9b78c805ba4f72e0a3 /src/gun_sse.erl | |
parent | 2b1e66f2f25e5d812f1b44c884fd99b1a7af38e6 (diff) | |
download | gun-02fa5f3606b5e18fb21fe48afcc73dad71b36ec9.tar.gz gun-02fa5f3606b5e18fb21fe48afcc73dad71b36ec9.tar.bz2 gun-02fa5f3606b5e18fb21fe48afcc73dad71b36ec9.zip |
Send a gun_sse message when the SSE stream closes
The message takes the following form:
{gun_sse, Pid, Ref, fin}
In other words instead of an event we get a 'fin' atom.
Diffstat (limited to 'src/gun_sse.erl')
-rw-r--r-- | src/gun_sse.erl | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gun_sse.erl b/src/gun_sse.erl index 4fe7419..835a7a8 100644 --- a/src/gun_sse.erl +++ b/src/gun_sse.erl @@ -45,5 +45,11 @@ handle(IsFin, Data, State=#state{reply_to=ReplyTo, stream_ref=StreamRef, sse_sta ReplyTo ! {gun_sse, self(), StreamRef, Event}, handle(IsFin, <<>>, State#state{sse_state=SSE}); {more, SSE} -> + case IsFin of + fin -> + ReplyTo ! {gun_sse, self(), StreamRef, fin}; + _ -> + ok + end, {done, State#state{sse_state=SSE}} end. |