diff options
Diffstat (limited to 'test/handlers/ws_init_h.erl')
-rw-r--r-- | test/handlers/ws_init_h.erl | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/handlers/ws_init_h.erl b/test/handlers/ws_init_h.erl index db5307b..c44986f 100644 --- a/test/handlers/ws_init_h.erl +++ b/test/handlers/ws_init_h.erl @@ -8,9 +8,9 @@ -export([websocket_handle/2]). -export([websocket_info/2]). -init(Req, _) -> +init(Req, Opts) -> State = binary_to_atom(cowboy_req:qs(Req), latin1), - {cowboy_websocket, Req, State}. + {cowboy_websocket, Req, State, Opts}. %% Sleep to make sure the HTTP response was sent. websocket_init(State) -> @@ -36,7 +36,10 @@ do_websocket_init(State=reply_many_hibernate) -> do_websocket_init(State=reply_many_close) -> {[{text, "Hello"}, close], State}; do_websocket_init(State=reply_many_close_hibernate) -> - {[{text, "Hello"}, close], State, hibernate}. + {[{text, "Hello"}, close], State, hibernate}; +do_websocket_init(State=reply_trap_exit) -> + Text = "trap_exit: " ++ atom_to_list(element(2, process_info(self(), trap_exit))), + {[{text, Text}, close], State, hibernate}. websocket_handle(_, State) -> {[], State}. |