diff options
Diffstat (limited to 'examples/chunked_hello_world')
-rw-r--r-- | examples/chunked_hello_world/src/toppage_handler.erl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/chunked_hello_world/src/toppage_handler.erl b/examples/chunked_hello_world/src/toppage_handler.erl index 22e52b9..3865698 100644 --- a/examples/chunked_hello_world/src/toppage_handler.erl +++ b/examples/chunked_hello_world/src/toppage_handler.erl @@ -5,11 +5,11 @@ -export([init/2]). -init(Req, Opts) -> - cowboy_req:chunked_reply(200, Req), - cowboy_req:chunk("Hello\r\n", Req), +init(Req0, Opts) -> + Req = cowboy_req:stream_reply(200, Req0), + cowboy_req:stream_body("Hello\r\n", nofin, Req), timer:sleep(1000), - cowboy_req:chunk("World\r\n", Req), + cowboy_req:stream_body("World\r\n", nofin, Req), timer:sleep(1000), - cowboy_req:chunk("Chunked!\r\n", Req), + cowboy_req:stream_body("Chunked!\r\n", fin, Req), {ok, Req, Opts}. |