aboutsummaryrefslogtreecommitdiffstats
path: root/examples/eventsource/src/eventsource_handler.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2016-08-10 17:15:02 +0200
committerLoïc Hoguin <[email protected]>2016-08-10 17:15:02 +0200
commite30d120bd8c9a4a7b469937d5b5be6a8dfe148d4 (patch)
tree5eb48865b2ad61d3c05bdc0e3e1f639a6b966ffe /examples/eventsource/src/eventsource_handler.erl
parentaa6f2ab5a48d90e47648dfb53e0894dcaa6f6aac (diff)
downloadcowboy-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.erl6
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}.