aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/cowboy_websocket.erl18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/cowboy_websocket.erl b/src/cowboy_websocket.erl
index 50d5b9b..40046e1 100644
--- a/src/cowboy_websocket.erl
+++ b/src/cowboy_websocket.erl
@@ -602,8 +602,8 @@ handler_call(State=#state{handler=Handler}, Req, HandlerState,
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} ->
@@ -613,8 +613,8 @@ handler_call(State=#state{handler=Handler}, Req, HandlerState,
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);
@@ -624,9 +624,8 @@ handler_call(State=#state{handler=Handler}, Req, HandlerState,
{{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} ->
@@ -635,9 +634,8 @@ handler_call(State=#state{handler=Handler}, Req, HandlerState,
{{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);