From 02fa5f3606b5e18fb21fe48afcc73dad71b36ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 16 Jun 2017 17:46:15 +0200 Subject: 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. --- src/gun_sse.erl | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/gun_sse.erl') 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. -- cgit v1.2.3