mirror of
https://github.com/ninenines/cowboy.git
synced 2025-07-14 12:20:24 +00:00
Add an undocumented stream_events function
I will test it on a private project before settling on it.
This commit is contained in:
parent
f08f4610a0
commit
b2b5e3a01a
1 changed files with 9 additions and 1 deletions
|
@ -80,7 +80,8 @@
|
|||
-export([stream_reply/3]).
|
||||
%% @todo stream_body/2 (nofin)
|
||||
-export([stream_body/3]).
|
||||
%% @todo stream_event/2,3
|
||||
%% @todo stream_events/2 (nofin)
|
||||
-export([stream_events/3]).
|
||||
-export([stream_trailers/2]).
|
||||
-export([push/3]).
|
||||
-export([push/4]).
|
||||
|
@ -786,6 +787,13 @@ stream_body(Data, IsFin, #{pid := Pid, streamid := StreamID, has_sent_resp := he
|
|||
Pid ! {{Pid, StreamID}, {data, IsFin, Data}},
|
||||
ok.
|
||||
|
||||
-spec stream_events(cow_sse:event() | [cow_sse:event()], fin | nofin, req()) -> ok.
|
||||
stream_events(Event, IsFin, Req) when is_map(Event) ->
|
||||
stream_events([Event], IsFin, Req);
|
||||
stream_events(Events, IsFin, #{pid := Pid, streamid := StreamID, has_sent_resp := headers}) ->
|
||||
Pid ! {{Pid, StreamID}, {data, IsFin, cow_sse:events(Events)}},
|
||||
ok.
|
||||
|
||||
-spec stream_trailers(cowboy:http_headers(), req()) -> ok.
|
||||
stream_trailers(Trailers, #{pid := Pid, streamid := StreamID, has_sent_resp := headers}) ->
|
||||
Pid ! {{Pid, StreamID}, {trailers, Trailers}},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue