diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/eventsource/src/eventsource_app.erl | 6 | ||||
-rw-r--r-- | examples/eventsource/src/eventsource_handler.erl | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/examples/eventsource/src/eventsource_app.erl b/examples/eventsource/src/eventsource_app.erl index 6ee8611..a5f4289 100644 --- a/examples/eventsource/src/eventsource_app.erl +++ b/examples/eventsource/src/eventsource_app.erl @@ -17,9 +17,9 @@ start(_Type, _Args) -> {"/", cowboy_static, {priv_file, eventsource, "index.html"}} ]} ]), - {ok, _} = cowboy:start_http(http, 100, [{port, 8080}], [ - {env, [{dispatch, Dispatch}]} - ]), + {ok, _} = cowboy:start_clear(http, 100, [{port, 8080}], #{ + env => #{dispatch => Dispatch} + }), eventsource_sup:start_link(). stop(_State) -> diff --git a/examples/eventsource/src/eventsource_handler.erl b/examples/eventsource/src/eventsource_handler.erl index 0e06ede..6dced4b 100644 --- a/examples/eventsource/src/eventsource_handler.erl +++ b/examples/eventsource/src/eventsource_handler.erl @@ -7,8 +7,9 @@ -export([info/3]). init(Req, Opts) -> - Headers = [{<<"content-type">>, <<"text/event-stream">>}], - Req2 = cowboy_req:chunked_reply(200, Headers, Req), + Req2 = cowboy_req:chunked_reply(200, #{ + <<"content-type">> => <<"text/event-stream">> + }, Req), erlang:send_after(1000, self(), {message, "Tick"}), {cowboy_loop, Req2, Opts, 5000}. |