diff options
author | Loïc Hoguin <[email protected]> | 2011-03-18 00:15:46 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2011-03-18 00:15:46 +0100 |
commit | f53235549d7d15a6ceeb105530d93786af1f0d57 (patch) | |
tree | 4b9508e27e05d32c68e25cbfbf2e2e51480d4bd3 /README.md | |
parent | a77b906b9f753b7ca30f4979551af0ac699b34ad (diff) | |
download | cowboy-f53235549d7d15a6ceeb105530d93786af1f0d57.tar.gz cowboy-f53235549d7d15a6ceeb105530d93786af1f0d57.tar.bz2 cowboy-f53235549d7d15a6ceeb105530d93786af1f0d57.zip |
Introduce Handler:init/2 for initializing the handler state.
We need an init function in order to process upgrade instructions
for protocols like WebSockets, but also to request an active receive
mode for long-polling connections, both of which will be implemented
at a later time.
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -63,7 +63,10 @@ use one of the predefined handlers or write your own. An hello world HTTP handler could be written like this: -module(my_handler). - -export([handle/2]). + -export([init/2, handle/2]). - handle(Opts, Req) -> + init(Req, Opts) -> + {ok, undefined}. + + handle(Req, State) -> {reply, 200, [], "Hello World!"}. |