diff options
author | Loïc Hoguin <[email protected]> | 2016-08-10 17:15:02 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2016-08-10 17:15:02 +0200 |
commit | e30d120bd8c9a4a7b469937d5b5be6a8dfe148d4 (patch) | |
tree | 5eb48865b2ad61d3c05bdc0e3e1f639a6b966ffe /examples/eventsource/src/eventsource_handler.erl | |
parent | aa6f2ab5a48d90e47648dfb53e0894dcaa6f6aac (diff) | |
download | cowboy-e30d120bd8c9a4a7b469937d5b5be6a8dfe148d4.tar.gz cowboy-e30d120bd8c9a4a7b469937d5b5be6a8dfe148d4.tar.bz2 cowboy-e30d120bd8c9a4a7b469937d5b5be6a8dfe148d4.zip |
Make reply functions return Req
Diffstat (limited to 'examples/eventsource/src/eventsource_handler.erl')
-rw-r--r-- | examples/eventsource/src/eventsource_handler.erl | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/eventsource/src/eventsource_handler.erl b/examples/eventsource/src/eventsource_handler.erl index fec2516..d4f51c1 100644 --- a/examples/eventsource/src/eventsource_handler.erl +++ b/examples/eventsource/src/eventsource_handler.erl @@ -6,10 +6,10 @@ -export([init/2]). -export([info/3]). -init(Req, Opts) -> - cowboy_req:stream_reply(200, #{ +init(Req0, Opts) -> + Req = cowboy_req:stream_reply(200, #{ <<"content-type">> => <<"text/event-stream">> - }, Req), + }, Req0), erlang:send_after(1000, self(), {message, "Tick"}), {cowboy_loop, Req, Opts, 5000}. |