diff options
author | Loïc Hoguin <[email protected]> | 2019-07-25 10:40:12 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-07-25 10:40:12 +0200 |
commit | 293ca3d58f64cd716e8b1f84330c29f229d5a4f2 (patch) | |
tree | 1fdc9cf90f18dd6228c48a9a9e9b108ba3d2f0c4 /test/handlers/ws_echo_h.erl | |
parent | 9e73a972b73a67dc5b8f23f99061f20713148e4e (diff) | |
download | gun-293ca3d58f64cd716e8b1f84330c29f229d5a4f2.tar.gz gun-293ca3d58f64cd716e8b1f84330c29f229d5a4f2.tar.bz2 gun-293ca3d58f64cd716e8b1f84330c29f229d5a4f2.zip |
Rename ws_echo test handler to ws_echo_h
Diffstat (limited to 'test/handlers/ws_echo_h.erl')
-rw-r--r-- | test/handlers/ws_echo_h.erl | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/handlers/ws_echo_h.erl b/test/handlers/ws_echo_h.erl new file mode 100644 index 0000000..692e6a6 --- /dev/null +++ b/test/handlers/ws_echo_h.erl @@ -0,0 +1,22 @@ +%% Feel free to use, reuse and abuse the code in this file. + +-module(ws_echo_h). + +-export([init/2]). +-export([websocket_handle/2]). +-export([websocket_info/2]). + +init(Req, _) -> + {cowboy_websocket, Req, undefined, #{ + compress => true + }}. + +websocket_handle({text, Data}, State) -> + {[{text, Data}], State}; +websocket_handle({binary, Data}, State) -> + {[{binary, Data}], State}; +websocket_handle(_Frame, State) -> + {[], State}. + +websocket_info(_Info, State) -> + {[], State}. |