aboutsummaryrefslogblamecommitdiffstats
path: root/test/handlers/sse_mime_param_h.erl
blob: 7e0c0e9647710bc673e9c5dbd29a6771dce6b706 (plain) (tree)


















                                                                            
%% This module implements a loop handler that sends
%% a lone id: line.

-module(sse_mime_param_h).

-export([init/2]).
-export([info/3]).

init(Req, State) ->
	self() ! timeout,
	{cowboy_loop, cowboy_req:stream_reply(200, #{
		<<"content-type">> => <<"text/event-stream;encoding=UTF-8">>
	}, Req), State}.

info(timeout, Req, State) ->
	cowboy_req:stream_events(#{
		id => <<"hello">>
	}, nofin, Req),
	{stop, Req, State}.