diff options
author | Sergey Prokhorov <[email protected]> | 2013-08-13 23:29:16 +0400 |
---|---|---|
committer | Sergey Prokhorov <[email protected]> | 2013-08-13 23:29:16 +0400 |
commit | 01d30568dd2f3a51a683921f0d2be76c2f32cca1 (patch) | |
tree | cc93c990bd04823cb013dad898616802951d2bdb /src | |
parent | 3b4c0588e9bb98307576f7d6e0b52ea434138e62 (diff) | |
download | cowboy-01d30568dd2f3a51a683921f0d2be76c2f32cca1.tar.gz cowboy-01d30568dd2f3a51a683921f0d2be76c2f32cca1.tar.bz2 cowboy-01d30568dd2f3a51a683921f0d2be76c2f32cca1.zip |
Allow atom responses in websocket handlers #563
Diffstat (limited to 'src')
-rw-r--r-- | src/cowboy_websocket.erl | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/cowboy_websocket.erl b/src/cowboy_websocket.erl index 073d7c6..75c55da 100644 --- a/src/cowboy_websocket.erl +++ b/src/cowboy_websocket.erl @@ -610,8 +610,8 @@ handler_call(State=#state{handler=Handler, handler_opts=HandlerOpts}, Req, NextState(State#state{hibernate=true}, Req2, HandlerState2, RemainingData); {reply, Payload, Req2, HandlerState2} - when is_tuple(Payload) -> - case websocket_send(Payload, State) of + when is_list(Payload) -> + case websocket_send_many(Payload, State) of {ok, State2} -> NextState(State2, Req2, HandlerState2, RemainingData); {shutdown, State2} -> @@ -621,8 +621,8 @@ handler_call(State=#state{handler=Handler, handler_opts=HandlerOpts}, Req, handler_terminate(State2, Req2, HandlerState2, Error) end; {reply, Payload, Req2, HandlerState2, hibernate} - when is_tuple(Payload) -> - case websocket_send(Payload, State) of + when is_list(Payload) -> + case websocket_send_many(Payload, State) of {ok, State2} -> NextState(State2#state{hibernate=true}, Req2, HandlerState2, RemainingData); @@ -632,9 +632,8 @@ handler_call(State=#state{handler=Handler, handler_opts=HandlerOpts}, Req, {{error, _} = Error, State2} -> handler_terminate(State2, Req2, HandlerState2, Error) end; - {reply, Payload, Req2, HandlerState2} - when is_list(Payload) -> - case websocket_send_many(Payload, State) of + {reply, Payload, Req2, HandlerState2} -> + case websocket_send(Payload, State) of {ok, State2} -> NextState(State2, Req2, HandlerState2, RemainingData); {shutdown, State2} -> @@ -643,9 +642,8 @@ handler_call(State=#state{handler=Handler, handler_opts=HandlerOpts}, Req, {{error, _} = Error, State2} -> handler_terminate(State2, Req2, HandlerState2, Error) end; - {reply, Payload, Req2, HandlerState2, hibernate} - when is_list(Payload) -> - case websocket_send_many(Payload, State) of + {reply, Payload, Req2, HandlerState2, hibernate} -> + case websocket_send(Payload, State) of {ok, State2} -> NextState(State2#state{hibernate=true}, Req2, HandlerState2, RemainingData); |