Permalink
Browse files

Close connection on a json decoding problem.

  • Loading branch information...
1 parent a0a0239 commit fb986adc311267ec6c02ebfdec8f1017671a98dc @majek majek committed Oct 18, 2011
Showing with 7 additions and 3 deletions.
  1. +7 −3 src/sockjs_cowboy_handler.erl
@@ -44,9 +44,13 @@ websocket_handle({text, <<"">>}, Req, State) ->
websocket_handle({text, Text}, Req,
State = #ws_state{self = Self, recv = Receive}) ->
- {ok, Decoded} = sockjs_util:decode(Text),
- Receive(Self, {recv, Decoded}),
- {ok, Req, State};
+ case sockjs_util:decode(Text) of
+ {ok, Decoded} ->
+ Receive(Self, {recv, Decoded}),
+ {ok, Req, State};
+ {error, _} ->
+ {shutdown, Req, State}
+ end;
websocket_handle(Data, Req, State) ->
io:format("Handle ~p~n", [Data]),

0 comments on commit fb986ad

Please sign in to comment.