anchor.diff:  decode(Data, Message) ->
     decode(Data, continue_message, Message).
   
  +
  +%
  +% Internal
  +%
  +-spec encode(Data::binary(), Type :: atom(), Acc ::list()) -> list().
  +encode(<<Data:?FRAGMENT_SIZE/binary>>, Type, Acc) ->
  +  [frame(Data, [fin, {opcode, Type}]) | Acc];
  +
  +encode(<<Data:?FRAGMENT_SIZE/binary, Rest/binary>>, Type, []) ->
  +  encode(Rest, continuation, [frame(Data, [{opcode, Type}]) | []]);
  +
  +encode(<<Data:?FRAGMENT_SIZE/binary, Rest/binary>>, Type, Acc) ->
  +  encode(Rest, Type, [frame(Data, [{opcode, Type}]) | Acc]);
  +
  +encode(<<>>, _Type, Acc) ->
  +  Acc;
  +
  +encode(<<Data/binary>>, Type, Acc) ->
  +  [frame(Data, [fin, {opcode, Type}]) | Acc].
  +
  +-spec frame(Data::binary(), Options::list()) -> binary().
  +frame(Data, Options) ->
  +  Frame = wsecli_framing:frame(Data, Options),
  +  wsecli_framing:to_binary(Frame).
  +
   -spec decode(Data::binary(), Type :: message_type(), Message::#message{}) -> list(#message{}).
   decode(Data, begin_message, _Message) ->
     Frames = wsecli_framing:from_binary(Data),
  
positive.code:   lists:reverse(process_frames(continue_message, Frames, [Message | []])).
  
  -spec process_frames(Type:: message_type(), Frames :: list(#frame{}), Messages :: list(#message{})) -> list(#message{}).
  process_frames(begin_message, [Frame | Frames], Acc) ->
    case process_frame(Frame, begin_message, #message{}) of
      {fragmented, Message} ->
        process_frames(continue_message, Frames, [Message#message{type = fragmented} | Acc]);
      {completed, Message} ->
        process_frames(begin_message, Frames, [Message | Acc])
    end;
  
  process_frames(continue_message, [Frame | Frames], [FramgmentedMessage | Acc]) ->
    case process_frame(Frame, continue_message, FramgmentedMessage) of
      {fragmented, Message} ->
        process_frames(continue_message, Frames, [Message#message{type = fragmented} | Acc]);
      {completed, Message} ->
        process_frames(begin_message, Frames, [Message | Acc])
    end;
  
  process_frames(_, [], Acc) ->
    Acc.
  
  -spec process_frame(Frame :: #frame{}, MessageType :: message_type(), Message :: #message{})-> {fragmented | completed, #message{}}.
  process_frame(Frame, begin_message, Message) ->
  
negative.code: contatenate_payload_from_frames(Frames) ->
    contatenate_payload_from_frames(Frames, <<>>).
  
  contatenate_payload_from_frames([], Acc) ->
    Acc;
  contatenate_payload_from_frames([Frame | Rest], Acc) ->
    contatenate_payload_from_frames(Rest, <<Acc/binary, (Frame#frame.payload)/binary>>).
  
  