anchor.diff:      wsecli:on_message(Socket, fun(Type, Data) -> Pid ! {Type, Data} end),
       wsecli:on_close(Socket, fun(_) -> Pid ! tcp_closed end),
       wait_for_socket_start(),
  -    {ok, Parser0} = exml_stream:new_parser(),
  -    Parser = fake_root(Parser0, LegacyWS),
  +    ParserOpts = if
  +                     LegacyWS -> [];
  +                     true -> [{infinite_stream, true}, {autoreset, true}]
  +                 end,
  +    {ok, Parser} = exml_stream:new_parser(ParserOpts),
       {ok, #state{owner = Owner,
                   socket = Socket,
                   parser = Parser,
  
positive.code:     Zout = zlib:open(),
      ok = zlib:inflateInit(Zin),
      ok = zlib:deflateInit(Zout),
      {ok, NewParser0} = exml_stream:reset_parser(Parser),
      NewParser = fake_root(NewParser0, State#state.legacy_ws),
      {reply, Socket, State#state{parser = NewParser,
                                  compress = {zlib, {Zin,Zout}}}};
  handle_call(stop, _From, #state{socket = Socket,
  
negative.code:     wsecli:send(State#state.socket, Data),
      {noreply, State};
  handle_cast(reset_parser, #state{parser = Parser} = State) ->
      {ok, NewParser} = exml_stream:reset_parser(Parser),
      {noreply, State#state{parser = NewParser}}.
  
  handle_info(tcp_closed, State) ->
  