From e25634cd9db82a4760087a2ba68d4c6a76353d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 27 Jul 2015 23:58:58 +0200 Subject: Add optional callbacks Mostly useful for REST, which has a ton. This is an initial commit, it still needs to be tested, but it's time to sleep. --- src/cowboy_websocket.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/cowboy_websocket.erl') diff --git a/src/cowboy_websocket.erl b/src/cowboy_websocket.erl index 12728d0..3c34908 100644 --- a/src/cowboy_websocket.erl +++ b/src/cowboy_websocket.erl @@ -45,7 +45,9 @@ | {reply, cow_ws:frame() | [cow_ws:frame()], Req, State, hibernate} | {stop, Req, State} when Req::cowboy_req:req(), State::any(). -%% @todo optional -callback terminate(terminate_reason(), cowboy_req:req(), state()) -> ok. + +-callback terminate(any(), cowboy_req:req(), any()) -> ok. +-optional_callbacks([terminate/3]). -record(state, { env :: cowboy_middleware:env(), -- cgit v1.2.3