anchor.diff:  		true -> ok
   	end.
   
  +unmask(Data, undefined, _) ->
  +	Data;
   unmask(Data, MaskKey, 0) ->
  -	do_unmask(Data, MaskKey, <<>>);
  +	mask(Data, MaskKey, <<>>);
   %% We unmask on the fly so we need to continue from the right mask byte.
   unmask(Data, MaskKey, UnmaskedLen) ->
   	Left = UnmaskedLen rem 4,
   	Right = 4 - Left,
   	MaskKey2 = (MaskKey bsl (Left * 8)) + (MaskKey bsr (Right * 8)),
  -	do_unmask(Data, MaskKey2, <<>>).
  -
  -do_unmask(<<>>, _, Unmasked) ->
  +	mask(Data, MaskKey2, <<>>).
  +
  +mask(<<>>, _, Unmasked) ->
   	Unmasked;
  -do_unmask(<< O:32, Rest/bits >>, MaskKey, Acc) ->
  +mask(<< O:32, Rest/bits >>, MaskKey, Acc) ->
   	T = O bxor MaskKey,
  -	do_unmask(Rest, MaskKey, << Acc/binary, T:32 >>);
  -do_unmask(<< O:24 >>, MaskKey, Acc) ->
  +	mask(Rest, MaskKey, << Acc/binary, T:32 >>);
  +mask(<< O:24 >>, MaskKey, Acc) ->
   	<< MaskKey2:24, _:8 >> = << MaskKey:32 >>,
   	T = O bxor MaskKey2,
   	<< Acc/binary, T:24 >>;
  -do_unmask(<< O:16 >>, MaskKey, Acc) ->
  +mask(<< O:16 >>, MaskKey, Acc) ->
   	<< MaskKey2:16, _:16 >> = << MaskKey:32 >>,
   	T = O bxor MaskKey2,
   	<< Acc/binary, T:16 >>;
  -do_unmask(<< O:8 >>, MaskKey, Acc) ->
  +mask(<< O:8 >>, MaskKey, Acc) ->
   	<< MaskKey2:8, _:24 >> = << MaskKey:32 >>,
   	T = O bxor MaskKey2,
   	<< Acc/binary, T:8 >>.
   
  -%% @todo Try using iodata() and see if it improves anything.
   inflate_frame(Data, Inflate, TakeOver, FragState, true)
   		when FragState =:= undefined; element(1, FragState) =:= fin ->
   	Data2 = zlib:inflate(Inflate, << Data/binary, 0, 0, 255, 255 >>),
  
positive.code: %% Empty last frame of compressed message.
  parse_payload(Data, _, Utf8State, _, _, 0, {fin, _, << 1:1, 0:2 >>},
  		#{inflate := Inflate, inflate_takeover := TakeOver}, _) ->
  	case TakeOver of
  		no_takeover -> zlib:inflateReset(Inflate);
  		takeover -> ok
  
negative.code: -type frame() :: close | ping | pong
  	| {text | binary | close | ping | pong, iodata()}
  	| {close, close_code(), iodata()}
  	| {fragment, fin | nofin, text | binary | continuation, iodata()}.
  -export_type([frame/0]).
  
  -type frame_type() :: fragment | text | binary | close | ping | pong.
  -export_type([frame_type/0]).
  
  -type mask_key() :: undefined | 0..16#ffffffff.
  -export_type([mask_key/0]).
  
  -type rsv() :: <<_:3>>.
  -export_type([rsv/0]).
  
  -type utf8_state() :: 0..8.
  -export_type([utf8_state/0]).
  
  %% @doc Generate a key for the Websocket handshake request.
  
  -spec key() -> binary().
  key() ->
  	base64:encode(crypto:rand_bytes(16)).
  
  %% @doc Encode the key into the accept value for the Websocket handshake response.
  
  -spec encode_key(binary()) -> binary().
  encode_key(Key) ->
  	base64:encode(crypto:hash(sha, [Key, "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"])).
  
  %% @doc Negotiate the permessage-deflate extension.
  
  