aboutsummaryrefslogtreecommitdiffstats
path: root/test/websocket_handler.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2011-08-23 16:24:02 +0200
committerLoïc Hoguin <[email protected]>2011-08-23 23:49:58 +0200
commit2374aa7e07327acf8737823a75c1bf9bdfeafca4 (patch)
tree3f91b3bec61da780a87439434c05267a53c48d06 /test/websocket_handler.erl
parent24bf2c54d0f8e5a9edfa6f0fe8dfd01e2a57e1b0 (diff)
downloadcowboy-2374aa7e07327acf8737823a75c1bf9bdfeafca4.tar.gz
cowboy-2374aa7e07327acf8737823a75c1bf9bdfeafca4.tar.bz2
cowboy-2374aa7e07327acf8737823a75c1bf9bdfeafca4.zip
Add WebSocket drafts 7, 8, 9 and 10 implementation
The implementation is only partial for now but should work for all browsers implementing it.
Diffstat (limited to 'test/websocket_handler.erl')
-rw-r--r--test/websocket_handler.erl8
1 files changed, 5 insertions, 3 deletions
diff --git a/test/websocket_handler.erl b/test/websocket_handler.erl
index d06bfee..4ba2a67 100644
--- a/test/websocket_handler.erl
+++ b/test/websocket_handler.erl
@@ -20,12 +20,14 @@ websocket_init(_TransportName, Req, _Opts) ->
erlang:start_timer(1000, self(), <<"websocket_init">>),
{ok, Req, undefined}.
-websocket_handle(Data, Req, State) ->
- {reply, Data, Req, State}.
+websocket_handle({text, Data}, Req, State) ->
+ {reply, {text, Data}, Req, State};
+websocket_handle(_Frame, Req, State) ->
+ {ok, Req, State}.
websocket_info({timeout, _Ref, Msg}, Req, State) ->
erlang:start_timer(1000, self(), <<"websocket_handle">>),
- {reply, Msg, Req, State};
+ {reply, {text, Msg}, Req, State};
websocket_info(_Info, Req, State) ->
{ok, Req, State}.